Pakistan captain Misbah-ul-Haq fell just short of his sixth Test century but his team clung on to their slim hopes of salvaging the second Test against Sri Lanka after a stirring rearguard action in Dubai on Saturday.
Pakistan resumed the fourth day's play trailing Sri Lanka by 91 runs with seven second-innings wickets in hand but Misbah's dour 97 and wicketkeeper Sarfraz Ahmed's defiant unbeaten 70 powered them to 330 for seven when heavy drizzle forced an early close.
Ahmed and Saeed Ajmal (seven), whose bowling on the final day could prove crucial, will return on Sunday hoping to stretch the team's 107-run lead and hope for rain on a day with a cloudy forecast.
Resuming on 132 for three, the responsibility for erasing the deficit was on two of Pakistan's senior batsmen, Misbah and Younis Khan.
The duo adopted contrasting approaches with Younis's fluency complimented by Misbah's doggedness which frustrated the Sri Lankans for nearly an hour as Misbah needed 37 deliveries to score his first run of the day.
Younis, who stood well outside the crease to negate any swing, hit Suranga Lakmal through extra cover for the first boundary of the day but runs were not easy to come by.
The former Pakistan captain was lured in by the width of a Lakmal delivery and miscued a cut shot to give Prasanna Jayawardene his fourth catch of the innings.
Younis, who made a fluent 77 off 173 balls with five boundaries, added 129 for the fourth wicket with Misbah who looked unperturbed by the slow run rate.
Misbah added 52 more runs with Asad Shafiq (23) who fell to Shaminda Eranga with the new ball.
The 39-year-old right-hander occasionally broke the shackles, hitting Rangana Herath's first ball of the day to the midwicket boundary but the stocky left-arm spinner had the last laugh.
Swept for a four in the first delivery of another over, Herath sent down the third from round the wicket and spun it past Misbah's tentative blade and on to off-stump.
It took a nearly unplayable delivery to end Misbah's painstaking 248-ball vigil, which included eight fours and a six, before the tea break.
Bilawal Bhatti braved an injured hamstring to score 32 runs but could not lock an Eranga yorker which knocked off the bails.
Sarfraz reached his maiden fifty, however, the rookie stumper hitting seven boundaries in his unbeaten 123-ball knock.
Pakistan first innings 165
Sri Lanka first innings 388
Pakistan second innings (Overnight 132-3)
Khurram Manzoor c P. Jayawardene b Pradeep 6
Ahmed Shehzad c P. Jayawardene b Herath 9
Mohammad Hafeez c P. Jayawardene b Pradeep 1
Younis Khan c P. Jayawardene b. Lakmal 77
Misbah-ul-Haq b Herath 97
Asad Shafiq b Karunaratne b Eranga 23
Sarfraz Ahmed not out 70
Bilawal Bhatti b Eranga 32
Saeed Ajmal not out 7
Extras (b-1, lb-7) 8
Total (7 wickets; 123.3 overs) 330
Fall of wickets: 1-11, 2-12, 3-19, 4-148, 5-200, 6-245, 7-312
Bowling (to date): Lakmal 22-3-62-1, Pradeep 19-3-50-2, Herath 43.3-8-124-2, Eranga 33-9-70-2, Mathews 5-1-9-0, Sangakkara 1-0-7-0.
Image: Misbah-ul Haq
Photograph: Gareth Copley/Getty Images