Standing between General Pervez Musharraf, the Pakistani president, and Hamid Karzai, his Afghan counterpart, George Bush emphasised "the need to co-operate, to make sure that people have got a hopeful future" in both countries.
The Afghan and Pakistani leaders stood with Bush during a brief appearance outside the White House before a working dinner on Wednesday. The pair shook hands with Bush, but not with each other.
"Today's dinner is a chance for us to strategise together," Bush said.
"These two men are personal friends of mine," Bush said. "They are strong leaders who have an understanding of the world in which we live. They understand that the forces of moderation are being challenged by extremists and radicals."
During the 2 1/2-hour dinner across a round table, Karzai and Musharraf had cordial and frank exchanges, a senior Bush administration official said.
Karzai and Musharraf exchanged warm greetings with good humour earlier in the Oval Office and shook hands before leaving for the night, the official said on condition of anonymity.
Karzai and Musharraf have criticised each other's efforts in fighting Islamist fighters along their long, remote, mountainous border.
"They [Musharraf and Karzai] are strong leaders who have an understanding of the world in which we live. They understand that the forces of moderation are being challenged by extremists and radicals"
Afghan officials have claimed that Pakistan is letting Taliban fighters carry out attacks across the border into their country.
Musharraf has said Karzai has bad information and pointed out that 80,000 Pakistani troops have been deployed in the region.
Karzai has accused Musharraf of turning a blind eye to hatred and extremism being bred at Islamic schools in Pakistan.
Musharraf has hit back, saying Karzai was behaving "like an ostrich", refusing to acknowledge the truth and trying to shore up his political standing at home.
After the meal, the White House issued a statement that called the session a "constructive exchange" but outlined no new agreements or initiatives.
"They committed to supporting moderation and defeating extremism through greater intelligence sharing, co-ordinated action against terrorists and common efforts to enhance the prosperity of the people of Afghanistan and Pakistan," said the statement from Tony Snow, the White House press secretary.
Khurshid Kasuri, Pakistan's foreign minister, said in an interview before the meeting that Musharraf wanted Karzai to agree to "a verbal ceasefire" and the increased sharing of intelligence.
Musharraf faces little formal political opposition within Pakistan but lives under constant threat of assassination, while Karzai has struggled to extend his authority beyond the Afghan capital, Kabul, and is facing a loss of popular support.
Bush's dinner party came just weeks before congressional elections as he tries to convince voters that the Republicans are the best to lead the efforts to fight terrorism.
Public support in the US for the war in Iraq and the military commitment in Afghanistan has fallen significantly in recent months.