Pakistani President Pervez Musharraf and his Afghan counterpart, Hamid Karzai, have pledged to co-operate in the fight against Islamist militants.
Mr Karzai and Mr Musharraf agreed to share intelligence on militancy
At a meeting in Islamabad, the leaders said terrorism had brought suffering to people in both their countries.
Ties between the neighbours have often been strained, with mutual accusations of inaction against Taleban militants.
The cordial tone of the leaders' latest meeting contrasted with past exchanges, BBC correspondents say.
The leaders referred to their countries as twins and emphasised the shared threat from Islamist militants sympathetic to the deposed Taleban administration of Afghanistan.
"The key in fighting and enhancing the capability against terrorism and extremism is intelligence cooperation," Mr Musharraf said.
"The two intelligence agencies, on both sides, must cooperate more strongly if we are to deal with terrorists and extremists more effectively."
Mr Karzai said it was "incumbent" upon the two governments to "bring peace and stability".
He also acknowledged US reports that attacks across the Afghan-Pakistan border had fallen recently.
Taleban-linked militants based in the rugged Afghan-Pakistan border have been broadening a violent campaign against both countries' governments.
Mr Musharraf and Mr Karzai are both allies of the US and have frequently accused each other of offering sanctuary to the Taleban.
They have also in the past made similar pledges to co-operate against the militants.
Separately, Mr Karzai's government is under diplomatic pressure to cancel an order for the expulsion of two top international officials accused of talking to the Taleban.
A British UN employee and an Irishman heading the EU mission in Afghanistan have both been ordered to leave the country by Thursday.
According to the government in Kabul, the officials' alleged contacts with Taleban leaders in Helmand province had endangered national security.
A UN official in Kabul has denied the were talking to Taleban leaders.