Saudi King Abdullah has held talks in Islamabad with Pakistan premier Shaukat Aziz on the last day of his visit.
King Abdullah is the first Saudi head of state to visit in 30 years
Issues discussed included Iran's nuclear programme, Iraq, Afghanistan and India-Pakistan relations. An accord on economic co-operation was signed.
King Abdullah met President Musharraf on Wednesday and received Pakistan's highest award, the Nishan-e-Pakistan.
The king's visit, the first by a Saudi head of state since 1976, comes after a key trip to Pakistan's rival, India.
The BBC's Aamer Ahmed Khan in Karachi says the king's India trip caused some anxiety in Pakistan, a long time ally of Saudi Arabia.
He says King Abdullah's visit may help allay Pakistan's fears that the Saudis are aligning themselves more closely with India, whose booming economy is increasingly reliant on Saudi oil imports.
Our correspondent says Saudi leaders may have been dissuaded from visiting Pakistan during the 1980s and 1990s because of the volatile political situation.
Pakistani leaders have traditionally travelled to the Saudi holy city of Mecca on an umra, or minor pilgrimage.
Saudi Arabia is Pakistan's largest oil supplier and has given huge amounts of aid following the October earthquake.
King Abdullah visited Pakistan as crown prince in 2003.