Pakistan need to score 302 runs in the last two sessions of the match to win the third Test against Sri Lanka and salvage a draw in the series after fighting back on the final morning in Sharjah.
Sri Lanka looked to be retaining control heading into the last day as they boasted a lead of 220 with still five second-innings wickets in hand, while only needing a draw to win the three-match series 1-0.
However, after taking the field on 133 for five, they were bowled out for 214 on Monday morning as Pakistan gave themselves a glimmer of hope of getting the win they need.
Sri Lanka appeared to be cruising to victory with overnight duo Angelo Mathews and Prasanna Jayawardene steadily extending their sixth-wicket partnership to 62 and their side's overall lead to 276.
The momentum of the match changed, though, following the the dismissal of Mathews, caught by Khurram Manzoor at deep square leg off paceman Mohammad Talha for 31, which sparked a collapse that saw Sri Lanka lose their last five wickets for just 25 runs.
Spin duo Abdur Rehman (4-56) and Saeed Ajmal (3-53) haunted the Sri Lanka order by taking two wickets each, with the latter claiming the head of Jayawardene after the wicketkeeper had top-scored with 49.
Lunch immediately came following the fall of the final wicket of Shaminda Eranga to set up an exciting run chase with Pakistan having to win to level the series.