Veteran Kumar Sangakkara hit a 200-plus score for the 10th time to light up the fourth day's play in the first Test between Sri Lanka and Pakistan in Galle on Saturday.
The prolific left-hander made 221 as the hosts declared their first innings at 533-9 shortly before stumps, a lead of 82 runs over Pakistan's total of 451.
Left-arm spinner Rangana Herath then had opener Khurram Manzoor caught behind for three to reduce the tourists to 4-1 in six overs before the close.
Ahmed Shehzad was on one and nightwatchman Saeed Ajmal had yet to score when stumps were drawn, leaving Pakistan the task of batting out the final day to draw the opening encounter of the two-match series.
Sangakkara, second only behind Australian legend Don Bradman's tally of 12 scores of more than 200, took advantage of the easy-paced wicket to toy with the Pakistan attack for nearly 12 hours.
Pakistan's frontline off-spinner Ajmal, who went wicketless for 46 overs, grabbed five on either side of tea to finish with expensive figures of five for 166 from 59.1 overs.
Pakistan paid heavily for letting Sangakkara escape off the first ball of the day when Rehman spilled a chance at point off left-arm seamer Junaid Khan.
Junaid struck three deliveries later as Mahela Jayawardene was adjudged leg-before through the Decision Review System.
Umpire Ian Gould turned down a loud shout from the bowler, but Pakistan earned a positive verdict after appealing for a review from the TV official. Replays showed the ball hitting the top of the off-stump.
Jayawardene, who is due to quit Test cricket after the series ends in Colombo later this month, made 59 in a third-wicket stand of 113 with Sangakkara.
The 36-year-old Sangakkara had on Friday risen to fourth place on the list of century-makers with his 37th hundred, the seventh three-figure knock in his last 14 Tests.
Only the retired trio of India's Sachin Tendulkar, with 51 centuries, Jacques Kallis of South Africa, who had 45, and Ricky Ponting of Australia on 41, have scored more hundreds.
Skipper Angelo Mathews hit 91 during a fourth-wicket stand of 181 with Sangakkara before he was caught in the slips off Ajmal just before tea.
The Sri Lankan captain has been dismissed in the 90s on five occasions -- thrice on 91 against Pakistan since last December.
The second and final Test will be played on Jayawardene's home ground at the Sinhalese Sports Club in Colombo from August 14.