Skipper Misbahul 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 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 Lanka's bowlers who bowled with discipline and patience on a pitch which had little response for bowlers.
Sri Lanka will look for an 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 Dhabi 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 as if the match would be over soon but Sarfraz and Bhatti kept the fight before Shaminda Eranga bowled Bhatti in the dying moments.
Sarfraz said he felt more responsibility after Misbah's fall.
"When I was playing with Misbah, he was guiding me," said Sarfraz. "But when he got out I felt more responsibility and I will continue to fight on Sunday and if we add another 100 then we can win this match."
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. He took 38 balls to add to his overnight score of 53 and hit eight boundaries and a six under difficult circumstances.
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.