Sri Lanka captain Angelo Mathews batted through the fourth day to reach his second Test century and wrestle control away from Pakistan in their series opener at Abu Dhabi.
Pakistan began the day with some belief they could secure victory before stumps, but by the time light brought a premature end they were left bowed by Mathews' unbeaten 116.
Pakistan's misery started before play commenced after it was confirmed wicketkeeper Adnal Akmal would miss the remainder of the three-Test series after fracturing his hand when taking the catch to dismiss Kaushal Silva from the final ball yesterday.
Dinesh Chandimal was the only batsman to fall during the day, hooking at Junaid Khan for 89, and with Sri Lanka finishing on 420 for five - a lead of 241 runs - it is now the tourists who have the best shot at victory.
Younus Khan was therefore handed the wicketkeeping 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 all out in their first innings, led his side away from danger alongside Chandimal.
Starting with a lead of just seven runs, and star batsmen Kumar Sangakkara and Mahela Jayawardene back in the pavilion, the tourists needed the captain's knock that Mathews studiously provided.
The 26-year-old, whose only previous international century came against Australia in 2011, first embarked on a 138-run stand alongside Chandimal that began to turn the tide against Pakistan, before adding an unbeaten 96 with Prasanna Jayawardene, who reached stumps two short of his own half-century.