Younis Khan and Asad Shafiq defied Sri Lanka during an unbroken fifth-wicket stand of 70 as Pakistan fought for survival in the first Test in Galle on Monday.
The tourists, set a near impossible victory target of 510, carried their second innings from the overnight score of 36-3 to 108-4 by lunch on the fourth day.
Younis, the most experienced batsman in the Pakistan side with 77 Test appearances, was unbeaten on 34 at the break with two boundaries.
Shafiq, playing his 14th Test, matched his senior partner with a fluent 36 not out that contained five hits to the fence.
Their partnership is Pakistan's best in the match in which the tourists were shot out for a paltry 100 in the first innings.
But Sri Lanka remain strong favourites to wrap up the game and take the lead in the three-Test series despite forecasts for rain interruptions till Tuesday evening.
Pakistan lost nightwatchman Saeed Ajmal in the day's third over, run out by a direct throw from the covers by Suraj Randiv.
Younis earned a repreive on nine when Tillakaratne Dilshan picked up a low catch at mid-off, but television replays proved inconclusive whether the catch had been taken cleanly.
Rangana Herath, the unlucky bowler on that occasion, went to lunch with figures of 1-20 in 15 overs. Off-spinner Randiv had 0-25 and seamer Nuwan Kulasekara took 2-24.