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.
The attacks come a day after Col Gaddafi’s son Saadi was given refuge in neighbouring Niger.
He is among 32 members of Col Gaddafi’s inner circle – including three generals – who have crossed the expansive desert border into the central African nation since 2 September, Niger’s Prime Minister Brigi Rafini told diplomats on Monday.
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.
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.