Pakistan were still in with an outside chance of drawing their three-match series against Sri Lanka after progressing to 107 for three in pursuit of a victory target of 302 on day five of the final Test in Sharjah.
After their bowlers had fought back in the morning session to set up the run chase, Pakistan's top order scored at 4.45 an over in the afternoon to keep themselves in contention.
Opening duo Khurram Manzoor and Ahmed Shehzad each contributed scores of 21 before both fell to Suranga Lakmal, while Azhar Ali (29 not out), Younis Khan (29) and Sarfraz Ahmed (seven not out) also kept the scoreboard ticking over.
The loss of wickets kept setting Pakistan back and with 195 runs still needed in the final session, the odds are against them pulling off the chase, but they are not out of it yet.
That did not look the case at the start of the day as Sri Lanka, needing only a draw to win the series 1-0, looked in firm control as they boasted a lead of 220 still with five second-innings wickets in hand.
However, after taking the field on 133 for five they were bowled out for 214 as Pakistan gave themselves a glimmer of hope of getting the win they needed.
Sri Lanka appeared to be cruising along with overnight duo Angelo Mathews and Prasanna Jayawardene steadily extending their sixth-wicket partnership to 62 and their side's overall lead to 276.
But the dismissal of Mathews, caught by Manzoor at deep square leg off paceman Mohammad Talha for 31, sparked a collapse that saw Sri Lanka lose their last five wickets for just 25 runs.
Spin duo Abdur Rehman (four for 56) and Saeed Ajmal (three for 53) did the damage with two wickets apiece, with the latter accounting for Jayawardene after the wicketkeeper had top-scored with 49.
Lunch was taken immediately after the fall of the last wicket of Shaminda Eranga to set up the potentially exciting run chase.