Mohammad Yousuf and Younis Khan rewrote the record books before England rallied on the third day of the third Test at Headingley on Sunday.
Their record-breaking stand of 363 appeared to have left England, 1-0 up in the four-match series, on the backfoot.
But England, who'd made 515 in their first innings, recovered to take three wickets for four runs in 10 balls shortly before tea.
However, a match of fluctuating fortunes saw Pakistan's last wicket pair of Shahid Nazir (13 not out) and No 11 Danish Kaneria (a Test best 29) put on 42 in 66 balls to take their team to 538 and a first innings lead.
Left-arm spinner Monty Panesar led England's attack with three for 127 from 47.4 overs.
England survived the two overs to stumps to be three without loss in their second innings, a deficit of 20 runs, with Marcus Trescothick unbeaten on nought and captain Andrew Strauss three not out.
Yousuf fell eight runs short of what would have been his eighth double hundred and Younis was run out for 173.
Younis went when, after Pakistan captain Inzamam-ul-Haq called him for a sharp single, he failed to beat Sajid Mahmood's direct hit from mid-wicket.
And next ball Faisal Iqbal was lbw for nought to Paul Collingwood, the medium-pacer's first wicket in his 14th Test.
Then Inzamam (26) exited in bizarre fashion when, trying to sweep Panesar, he over-balanced and fell into his own stumps to be out hit-wicket.
At tea Pakistan were 451 for six with wicket-keeper Kamran Akmal four not out.
The tail wagged, with Akmal (20) and Mohammad Sami (19) making useful contributions.
But when Panesar, often mocked by crowds for his fielding, took a low catch on the fine leg boundary after Umar Gul top-edged a hook off Mahmood, Pakistan were 496 for nine.
Kaneria though struck Panesar for six before he was caught off his fellow spinner by first slip Trescothick.
While Younis and Yousuf were together they bolstered Pakistan's hopes of an unlikely victory.
Their stand spanned five-and-three quarter hours, the duo joining forces when Pakistan were in trouble at 36 for two before delighting spectators and statisticians alike with some sumptuous strokeplay.
Theirs was the fifth highest stand in Test history against England, beating Jack Fingleton and Don Bradman's sixth-wicket 346 for Australia at Melbourne in 1936/37.
It was also the best third-wicket partnership against England, surpassing the 338 shared by West Indies greats Everton Weekes and Frank Worrell at Port-of-Spain in 1953/54.
And this stand was Pakistan's best for any wicket against England, overtaking the 322 for the fourth-wicket set by Javed Miandad and Salim Malik at Edgbaston in 1992.