Seven anti-Gaddafi fighters have been killed and 10 wounded in a fierce battle for the town of Bani Walid.
The fighters say they were betrayed by local people who claimed to be on their side and led them into an ambush.
Nato is targeting the town, held by forces loyal to the fugitive leader, but the attackers lack the forces to capture it, a BBC correspondent says.
Meanwhile 15 guards were killed when pro-Gaddafi forces attacked an oil refinery near the town of Ras Lanuf.
An injured oil worker said a convoy of vehicles launched the surprise attack on the refinery – controlled by the anti-Gaddafi National Transitional Council (NTC) – after approaching from the direction of the fugitive leader’s hometown of Sirte.
The refinery was not thought to be operational at the time.
In Tripoli, meanwhile, there has been an explosion at an arms dump near the international airport, the cause of which is unclear.
‘Leading the struggle’
The attacks come a day after Col Gaddafi’s son Saadi was given refuge in neighbouring Niger.
Anti-Gaddafi troops now control most of Libya, including the capital Tripoli. Loyalists are holding out in at least three towns, including Bani Walid and Sirte.
On Monday, China became the last permanent member of the UN’s Security Council to officially recognise the NTC as Libya’s “ruling authority”, state media reported.
Xinhua’s report of the announcement ended weeks of uncertainty about when China would endorse the anti-Gaddafi forces.
Correspondents say the move further isolates Col Gaddafi, whose whereabouts are unknown. In recent audio broadcasts he has insisted he will die in Libya.
A new message was aired by the Syrian-based Arrai TV channel on Monday, in which Col Gaddafi described the opposition forces in Libya as traitors and said he would fight against the “coup”.
However, whereas previous messages were audio recordings of Col Gaddafi, this was a statement read out on air.
Arrai’s owner, Mishan Jabouri, said Col Gaddafi was still “leading the struggle from Libyan lands, and not from Venezuela, Niger or anywhere else,” but that security reasons meant he could not read the message himself, Reuters reports.
The BBC’s Richard Galpin, near Bani Walid, says the anti-Gaddafi forces are within a kilometre of the centre of Bani Walid but are meeting fierce resistance.
They remain optimistic but need more fighters, our correspondent says, adding that, where he is located, they are about 100-strong.
Dozens of cars are streaming out of the town in anticipation of an assault.
Resident Fadila Salim told the Associated Press news agency that she was leaving because she was told “the fighting will be very bad”.
Her son Mohammed said many people were trapped and afraid to leave their homes.
Nato is becoming more involved in the battle, using fighter aircraft to target sites in the town, especially heavy weapons.
The attackers are hopeful that if they can secure Bani Walid, the other loyalist strongholds will fall more quickly.