More than 30 people were wounded in the fighting, Ali Muse, the head of the ambulance service in Mogadishu, said.
Fighters from al-Shabab, which the US says is al-Qaeda’s proxy in Somalia, routinely fire at the hilltop Villa Somali palace from other parts of Mogadishu.
Troops at the palace often launch shells back.
At an African Union summit in Addis Ababa, the Ethiopian capital on Friday, Ali Jama Jangeli, Somalia’s foreign minister, called for more AU forces to help about 5,000 peacekeepers from Uganda and Burundi who are currently based in Mogadishu.
Earlier, African leaders attending the summit expressed concern over the deteriorating situation in Somalia, saying it had posed an enormous threat to world peace.
The delegates also criticised the international community for turning a blind eye to the Somalia crisis.
The foreign ministers of Kenya and Sudan backed the call for more troops, with Djibouti saying it would send 450 soldiers soon.
But Sheikh Ali Mohamud Rage, al-Shabab’s spokesman, called on Djibouti to reconsider its decision.
“We warn the Djibouti government and strongly recommend that it not send its troops here, otherwise there will be bad consequences for it,” Rage said in Mogadishu on Sunday.
Violence has killed at least 21,000 people in the failed Horn of Africa nation since the start of 2007 and driven another 1.5 million from their homes, sparking one of the world’s worst humanitarian emergencies.
Somalia has had no central government for nearly two decades, leading to the rise of warlords, heavily armed militias and pirates terrorising shipping mainly in the Gulf of Aden.
Western security agencies say the country has become a safe haven for fighters who are using it to plot attacks across the region and beyond.