Sri Lanka hit back with three Pakistan wickets in Saturday's final session, including century-maker Younus Khan, to boost their chances of drawing the series by the close on the third day of the third and final Test in neutral Sharjah.
With two days remaining, Pakistan are 282 for six and trail Sri Lanka, who lost the second Test by nine wickets to go 1-0 down in the series, by 131 runs with four first-innings wickets in hand.
Put on the back foot for much of the first two days, Pakistan, resuming the day in a precarious position at 35-2, relied on Younus's 18th Test century before he fell for 122 and fifties from Azhar Ali (53) and Misbah-ul-Haq (50 not out).
After tea, left-arm paceman Chanaka Welegedara accounted for Younus by clean bowling the in-form batsman with the new ball, and he struck a short while later to remove Asad Shafiq for 16 when he edged to wicketkeeper Kaushal Silva.
Adnan Akmal was the day's final wicket shortly before the close of play, given out lbw for seven to the slow left-armers of Rangana Herath.
Younus, who scored his first run off the 31st delivery he faced, brought up three figures when he drove into the covers for a single in the last over before the tea interval.
Younus and Ali batted cautiously at the start, with the first run in their partnership coming after more than 50 balls, but started scoring freely as they spent longer at the crease.
The pair added 98 for the third wicket before Ali became Kosala Kulasekara's first Test victim when the nippy right-armer got one to angle back sharply into the Pakistan batsman's stumps.
Captain Misbah then came to the crease and added a further 100 with Younus before Sri Lanka's depleted attack, dealt a blow when paceman Dhammika Prasad was ruled out of the remainder of the Test with a thigh strain, hit back.
Pakistan, who won the second Test by nine wickets, are playing "home" Tests in the Gulf region due to security concerns in their own country.
Sri Lanka first innings 413
Pakistan first innings (overnight 35-2)
M. Hafeez c Jayawardene b Welegedara 6
T. Umar st Silva b Herath 19
A. Ali b Kulasekara 53
Y. Khan b Welegedara 122
Misbah-ul Haq not out 50
A. Shafiq c Silva b Welegedara 16
A. Akmal lbw b Herath 7
A. Rehman not out 3
Extras (nb-3, w-2, lb-1) 6
Total (six wickets, 110 overs) 282
Fall of wickets: 1-8, 2-35, 3-133, 4-233, 5-258, 6-277
Bowling: Welegedara 25-7-62-3, Prasad 4-0-9-0, Kulasekara 21-7-55-1, Herath 32-10-73-2, Randiv 21-5-64-0, Dilshan 7-1-18-0.