Pakistan set Sri Lanka a notional victory target of 261 in the final session of the second Test at Colombo but, barring a miracle, the clash appeared to be heading for a draw.
There had been faint hopes the tourists might triumph as Sri Lanka needed 74 more runs to avoid the follow-on with just five wickets in hand, but Kumar Sangakkara and Angelo Mathews steered Sri Lanka to 391 all out.
With a first-innings lead of 160, Pakistan came firing out of the traps in their second innings, with Abdur Rehman sent up the order to hammer a quick 36 off 22 balls as Pakistan sought to build a quick score in order to put the pressure on Sri Lanka.
They declared on 100 for two but with just one session remaining a stalemate is all but guaranteed in this rain-affected Test - even though it is less than 18 months since Sri Lanka collapsed against England at Cardiff last May.
Despite Sangakkara and Tillakaratne Dilshan both registering centuries on Tuesday, Pakistan took four quick wickets to raise hopes of making the hosts, still 273 runs adrift overnight, follow on.
But Sangakkara and Mathews put on 92 for the sixth wicket before the latter feathered Junaid Khan behind to depart for 47, which was the start of a sequence that saw Sri Lanka lose their last five wickets for 21 runs.
Sangakkara's wicket came in amongst the collapse as he fell for 192 after coming down the pitch and flicking Rehman to Taufeeq Umar at square leg.
That dismissal came after he also missed out on a double century in the last Test match in Galle when he was left stranded on 199 not out.
Mohammad Hafeez and Taufeeq put on a fifty partnership for Pakistan's opening wicket before the latter lobbed to Dilshan at square leg off Suraj Randiv, who then accounted for Rehman after the lower order batsman had plundered three fours and three sixes to boost Pakistan's total.
The tourists went for tea on 99 for two and curiously added just one more run before opting to declare, with opener Taufeeq unbeaten on 42, and set Sri Lanka their - highly unlikely - victory target.