Skipper Misbah-ul Haq led Pakistan's resistance with a gritty 97 to thwart Sri Lanka's victory bids on the fourth day of the second Test in Dubai on Saturday.
Misbah missed his sixth Test hundred by a mere three runs but a career best 70 not out by Sarfraz Ahmed and a defiant 32 by Bilawal Bhatti kept Pakistan's fight to take them to 330-7 at close on a cloudy day when Dubai stadium lights were on most of the day.
When bad light and drizzle ended play 15 overs before schedule, Saeed Ajmal was on seven and Pakistan were leading by 107 runs with a full day's play remaining.
Sarfraz added an invaluable 67 runs for the seventh wicket with Bhatti to frustrate the Sri Lankan bowlers who bowled with discipline and patience on a pitch which had little response for bowlers.
Sri Lanka will look for early wrap up of Pakistan's second innings to take a 1-0 lead in the three-match series after the first Test ended in a draw in Abu Dhbai last week.
The third and final Test will be played in Sharjah from Thursday.
When left-arm spinner Rangana Herath spun one across Misbah's bat to hit the off stump just 20 minutes before tea it looked the match will be over soon but Sarfraz and Bhatti kept the fight before Eranga bowled Bhatti in the dying moments.
Sarfraz improved on his highest Test score of 40 he made against South Africa at Centurion earlier this year by posting his maiden half century. He has so far hit seven boundaries during his 123-ball stay.
Sri Lanka had a good chance of dismissing Sarfraz at 51 but paceman Suranga Lakmal dropped a regulation caught and bowled chance to add to his team's woes after Misbah foiled them for nearly two sessions.
Misbah's valiant effort helped Pakistan avoid their first-ever innings defeat against Sri Lanka before his 412-minute resistance ended.
Misbah, who took 38 balls to add to his overnight score of 53, hit eight boundaries and a six under difficult circumstances.
He added an invaluable 129 for the fourth wicket with Younis Khan (77), 52 with Asad Shafiq (23) for the fifth and 45 for the sixth with Sarfarz to help Pakistan avoid innings defeat but finally succumbed to some persistent effort from Herath who has figures of 2-124.
Paceman Nuwan Pradeep had the best figures of 2-50 while Eranga took 2-70.
Pakistan resumed on 132-3 and needed Younis and Misbah to dig deep but Younis tried to drive a slightly wide delivery from Lakmal, managing only to edge it to wicketkeeper Prasanna Jayawardene, who held his eighth catch of the match.
Younis batted for 235 minutes and hit five boundaries, adding 129 runs for the third wicket with his skipper.
Sri Lanka took the second new ball with the score at 198-4 and were instantly rewarded in the second over when Eranga had Shafiq caught in the slip.
Both Misbah and Sarfraz survived confident leg-before appeals -- with the skipper reverting Indian umpire Sundaram Ravi's decision on 78 to add to Sri Lanka's day-long frustration.