The UN Security Council has agreed unanimously to increase the peacekeeping force in Somalia.
Council members asked the African Union to extend its deployment from 8,000 to 12,000 troops.
Uganda said it would contribute with an additional 4,000 troops.
The UN said the measure aimed to support Somalia's UN-backed government and to protect the civilian population from attacks by the Islamist al-Shabab and other militant groups.
The groups together control much of south and central Somalia - the government is in charge of about half of the capital, Mogadishu.
The African Union had called for its force, which has been in Somalia since March 2007, to be increased to 20,000.
Calls for reinforcements followed the deadly twin bomb blasts in the Ugandan capital, Kampala, during the football World Cup final in July.
Al-Shabab said it carried out the attacks in retaliation for Uganda's support for Somalia's transitional government.
Somalia has experienced almost constant conflict since the collapse of its central government in 1991.