All-rounder Angelo Mathews was closing in on his second Test century as Sri Lanka extended their lead to 176 runs against Pakistan at tea on day four of their series opener Abu Dhabi.
Mathews was unbeaten on 87 and, after a 138-run stand with Dinesh Chandimal (89), the tourists had started to forge a testing lead after Pakistan had dominated the opening three days.
Pakistan had led by 179 runs after the first innings, and began Friday morning in the box seat after reducing the tourists to 186 for four - a lead of just seven runs.
But just one wicket in the first two sessions meant Sri Lanka had gone from a job of saving the match to potentially building a match-winning position.
Pakistan's problems were compounded by the news wicketkeeper Adnal Akmal has been ruled out of the rest of the series after fracturing his left hand when taking the catch to dismiss Kaushal Silva from the final ball on the third day.
Younis Khan was therefore handed the wicketkeeper's gloves from the start on day four and he was left to watch on as Mathews, who hit 91 when Sri Lanka collapsed to 204 in the first innings, again led the way alongside Chandimal.
The pair both reached their half-centuries as they batted through the morning session. Chandimal tickled the out-of-sorts Saeed Ajmal to fine leg to reach his 50 and in the same over Mathews launched the spinner over his head for six.
Their stand reached three figures in the afternoon session, but just as Chandimal looked set to reach a century of his own he gifted away his wicket. A Junaid Khan (three for 79) bouncer provoked an ill-advised hook shot that Rahat Ali held at deep fine leg.
It was, however, the only moment of joy for Pakistan up until tea as Mathews remained steadfast to close in on his first Test century on foreign soil. The 26-year-old's only century to date came against Australia when he hit an unbeaten 105 in Colombo in 2011.
Wicketkeeper Prasanna Jayawardene was unbeaten alongside him on four.