Somali President Abdullahi Yusuf has warned his ministers that they cannot continue to serve in his government while leading militias into battle.
Warlords have joined forces to fight Islamist militias
His comments follow a week of fighting between an alliance of warlords - some of whom have seats in the transitional government - and an Islamist militia.
About 150 people, mainly civilians, have died in the capital Mogadishu.
One warlord, the Security Minister Mohamed Qanyare, says his militia is fighting "al-Qaeda in Somalia".
Mr Abdullahi called on both sides to end the fighting, and told the BBC the alliance of warlords "are not fighting on behalf of the government".
He said it was up to parliament "to take an appropriate action against those members who are waging the war".
And he called on the US to work with the government not "individuals in the capital" to fight terrorism.
There are strong suspicions the US has been secretly funding the warlords, although Washington insists it has not violated the arms embargo in Somalia, the BBC's Africa Editor David Bamford says.
But a top US diplomat in Africa, Jendayi Frazer, acknowledged on Friday that the White House would work with those who can help "prevent Somalia becoming a safe haven for terrorists".
Hospitals in Mogadishu have been overwhelmed with more than 250 people - many of them women and children - who have been wounded in the fighting.
Fighting continued on Saturday, despite appeals by the UN and the US - and an offer by Somali clan elders to broker a ceasefire.
SOMALIA'S THREE RIVAL GROUPS
Gets arms from: Ethiopia, Italy (Source: UN report)
Gets arms from: Eritrea (Source: UN report)
Anti-terror alliance of warlords
Believed to get support from US
The fighting has been concentrated in the CC district, where the clashes began a week ago.
Residents have been forced to flee or hide in storm drains amid an almost constant barrage of mortar shells and gunfire.
Dr Sheikh don Salad Elmi, the director of Medina hospital in South Mogadishu, where many have been brought in with severe injuries, said the fighting was affecting up to 200,000 inhabitants.
Pedram Yazdi of the International Committee of the Red Cross in Somalia said they were monitoring the movement of displaced civilians closely.
"It is difficult to know at the moment exactly how many people are affected, but we are assessing the situation, seeing where people are moving to and whether they need our assistance," he told the BBC.
The fighting began when warlords who had divided Mogadishu into fiefdoms united to tackle a growing Islamist force, our correspondent says.
He says the Islamists have managed to confine the four main warlords and their militias to separate pockets on the edges of the city
The UN says the Islamists now control 80% of the capital.
This is the second round of serious fighting in Mogadishu this year. In March, clashes between the two sides killed at least 90 people.
Somalia has not had an effective national authority for 15 years since the ousting of President Siad Barre in 1991.