Angelo Mathews scored his first Test century since taking over as Sri Lanka captain to help his side bat through day four against Pakistan in Abu Dhabi, ending with a lead of 241 runs.
Slow and steady accumulation enabled Sri Lanka to bat through the day, scoring 234 runs for the loss of just one wicket.
Mathews hit an unbeaten 116 in 282 balls, Dinesh Chandimal made 89 in 166 balls and Prasanna Jayawardene scored 48 not out as Sri Lanka closed on 420 for five.
Pakistan, with Younus Khan keeping wicket due to Adnan Akmal's finger injury, toiled hard all day but had only the wicket of Chandimal, caught by Rahat Ali off Junaid Khan, to show for their efforts.
Chandimal was perhaps eyeing up a third Test century when he top edged a pull to Rahat at fine leg and his disappointment was obvious.
Mathews made no such mistake, patiently making his way to a second century and a new highest score with an innings inclusive of 12 fours and one six.
Jayawardene had made 48 in 107 balls, putting on 96 with Mathews after Chandimal and Mathews had added 138 for the fifth wicket, which was Junaid's 50th in Test cricket.
That milestone was about all there was to cheer for Pakistan, who after they bowled out Sri Lanka for 204 in their second innings and then posted 383, had been well in charge of this game.
Now, depending on Sri Lanka's intentions on the final day, they could face a battle to salvage a draw.
© Cricket World 2014