Pakistan lost opener Mohammad Hafeez early before reaching 62 for one, still 115 runs behind Sri Lanka, at lunch on day three of the second Test at P Sara Oval on Saturday.
Ahmed Shehzad was batting on 39 at the break with Azhar Ali (14) at the other end as the tourists, who claimed the last Sri Lankan wicket in the morning to bowl out the hosts for 315, battled on to save the Test.
Leg-spinner Yasir Shah was the pick of the bowlers, taking six for 96 and ending the innings some 15 minutes after a rain-delayed start by removing Dushmantha Chameera (two).
Younis Khan took a good running catch as Sri Lanka, pressing for a series-levelling victory, took a 177-run first innings lead.
Shot out for 138 in their first innings, Pakistan did not have a great start in their second innings either with a laden-footed Hafeez (eight) poking at an Angelo Mathews delivery which was caught by Kumar Sangakkara in the slips.
Shehzad and Ali proved there was no demon in the pitch as they added 53 runs for the flourishing second wicket.
For Sri Lanka, Chameera left the field midway through his second over following a calf muscle niggle.