The leaders of the Democratic Republic of Congo and Uganda have agreed to pull troops from their common border to ease tensions over the oil-rich Lake Albert.
Mr Museveni (L) and Mr Kabila (R) will meet yearly to improve ties
The deal to withdraw troops immediately was signed by Ugandan President Yoweri Museveni and DR Congo President Joseph Kabila as they held talks in Tanzania.
The leaders agreed to co-operate on oil exploration in Lake Albert and to lay a joint pipeline to distribute any oil.
Uganda has twice invaded DR Congo, saying it was harbouring rebels.
In the past month alone, skirmishes along the border have killed at least four people - three Ugandans and a British oil contractor.
At the meeting in the north-eastern Tanzanian town of Arusha, Mr Museveni and Mr Kabila agreed to move their troops 150km (90 miles) from their mutual border.
They will also move refugee camps 150km from the border to improve security, Ugandan Foreign Affairs Minister Sam Kutesa said.
A joint team will draw up borders within contested areas of the lake as part of the deal.
Mr Museveni and Mr Kabila agreed to meet once a year to improve bilateral ties.
"Black Africans are always at each other's throats," Mr Kabila said.
"We are determined to see long-term peace reign among the two countries. Next time we meet, we won't discuss about border problems, but we will be discussing developmental issues."
In October, Mr Museveni announced Uganda had found oil in the lake area, saying production could begin in 2009 with initial output of up to 10,000 barrels a day.
Relations between the two countries remain fraught - Uganda has twice invaded Congo, claiming it wanted to flush out Ugandan rebels.
The second invasion sparked a 1998-2003 war that drew in five other countries.
Meanwhile, the United Nations has urged dissident DR Congo troops to re-join the country's army.
Thousands of DRC refugees have entered Uganda amid rebel clashes
The eastern part of DR Congo remains unstable amid recent fighting between rogue Congolese Gen Laurent Nkunda and government forces.
Maj-Gen Bikram Singh, commander of the UN DR Congo peacekeeping mission (Monuc), encouraged Gen Nkunda's troops to reintegrate into the army and help restore peace to the country.
An earlier attempt to reintegrate the rebels a few months ago failed.
Though a ceasefire is in place, there are real doubts whether it can hold, says the BBC's Karen Allen in Goma.
There have been reports of skirmishes near Virunga national park, home to Congo's famous mountain gorillas, and the army and Monuc are watching developments closely, our correspondent says.
Up to 35,000 DR Congo refugees have entered Uganda since Monday due to the fighting, the UN has said.