Pakistan's hopes of winning the second Test against Sri Lanka hinge on Asad Shafiq and Sarfaraz Ahmed who moved them to 198/5 at stumps on day four.
The pair shared a 146 run partnership towards the tail-end of day four to rescue Pakistan from a dire situation at 52 for five chasing 317 runs to win.
Earlier Sri Lanka had allowed the designated hosts back into the match by being bowled out for just 96, 386 runs less than their first innings effort.
Run-a-ball efforts from Niroshan Dickwella (21) and Rangana Herath (17) added some valuable runs but they would be disappointed with allowing Sarfaraz's team back into the contest.
Kusal Mendis top scored with 29 while Wahab Riaz's 4/31 made him the pick of the bowlers while Haris Sohail took three wickets in his single over for the cost of one run.
Sri Lanka seamers Lahiru Gamage and Nuwan Pradeep struck early to remove Sami Aslam (1) and Azhar Ali (17) respectively to leave Pakistan 36 for 2.
Dilruwan Perera then ran through three more Pakistan batsmen with an excellent spell of off-spin bowling.
Shan Masood (21) nicked off through to Dickwella just two overs after Haris 10) had done the same and Babar Azam (0) could last just two balls.
With the game slipping away Shafiq and Sarfaraz produced easily Pakistan's best session of the day combating the turning ball well and counter-attacking superbly and leaving the game balanced on a knife-edge.
We are set for a dramatic final day with the draw out of the question and Sri Lanka having burned all their reviews with Shafiq surviving a referral late in the day to end on 86 not out with Sarfaraz on 57 not out and Pakistan needing 119 further runs to win.