Sudan and Chad have agreed to end a crisis which began last year when fighting broke out on their border.
Chadian soldiers have been sent to border areas following attacks
The two countries signed an accord at a six-nation mini-summit in the Libyan capital, Tripoli, on Wednesday.
They agreed on peacekeeping force to stop insurgents crossing the frontier, but a BBC correspondent says it is not clear where troops will come from.
The neighbours had earlier accused each other of launching cross-border raids where Chad meets Sudan's Darfur region.
After months of dispute, the Tripoli accord commits the two countries to restore diplomatic relations and cease any attempts of cross-border conflict.
Chaired by Libyan leader Muammar Gaddafi, the summit was also attended by the heads of state of Congo, Burkina Faso and the Central African Republic.
Libyan Foreign Minister Abdel Rahman Shalgham said he considered today's developments to be the end of the dispute.
Sudanese Foreign Minister Al-Sammani al-Wasila told the BBC the talks were frank and produced the anticipated results.
The BBC's Rana Jawad in Tripoli says the participants in the mini-summit seem determined to live up to the agreement.
A recent report by Human Rights Watch blamed Sudan for the upsurge in conflict.
Chad declared a state of war with Sudan last year following a deadly attack launched from Darfur by Chadian rebels.
Chad said the rebels are trying to overthrow its president, Idriss Deby.
Sudan repeatedly denied allegations made by Chad that it was backing the rebels and sending Arab militias in support.
Sudan in turn accused the Chadians of shelling across the border.
With over two million displaced people still in camps in Darfur and Chad, the United Nations warned last week that the three-year-long conflict was in danger of assuming an international dimension.