Musharraf, who seized power in a coup eight years ago, has vowed to quit as army chief by November 15 if elected.
The supreme court judges retired on Friday after hearing final arguments on challenges by Makhdoom Amin Fahim, the PPP's vice-chairman, and by retired judge Wajihuddin Ahmad, who are both standing against Musharraf.
The deal with Bhutto's opposition party takes a huge amount of pressure off Musharraf, who is standing for another five-year term in office while still holding his post of army chief.
After increasingly frantic negotiations, the government and Bhutto's party said overnight they had both agreed on a national reconciliation accord which would be made public later on Friday.
The deal gives an amnesty for politicians active in Pakistan between 1988 and 1999 - effectively clearing Bhutto of the corruption charges that forced her into exile eight years ago.
"Pakistan needs a military leader who can control both civil and possible military extremism"
Creative_person01, Islamabad, Pakistan
Send us your views
It prepares the ground for Bhutto's planned homecoming on October 18 in the run-up to parliamentary elections due by early 2008.
The pact was announced after she met key party members in London.
"The agreement says that there will be an across-the-board indemnity for public office holders between 1988 and 1999," a senior government official who had seen the draft said on condition of anonymity.
Bhutto, whose Pakistan People's Party is the country's largest, had earlier threatened to undermine's Musharraf widely anticipated victory by pulling her MPs from parliament, after other opposition parties also resigned.
Sheikh Rashid, railways minister and a close confidant of Musharraf, said the deal was done.
"They have agreed on the draft and it will be issued by the president tomorrow (Friday)," he said.
"Benazir Bhutto has given her assent."
The cabinet was expected to give formal approval before sending the pact to Musharraf to sign, Tariq Azeem, the deputy information minister, said.
Musharraf's allies have a majority in the two houses of parliament and four provincial assemblies that will vote for the president.
Nevertheless, he would benefit from Bhutto's support in the run-up to the general election.