Pakistan, trailing Sri Lanka by 177 runs in the first innings, were 1-129 in their second knock at tea on the third day of the second Test in Colombo.
Ahmed Shehzad (69 not out) and Azhar Ali (47 not out) put on 120 runs for the unbroken second wicket after Mohammad Hafeez was dismissed by Angelo Mathews for eight.
Sri Lanka, who resumed at their overnight score of 9-304 after a delayed start due to bad weather, were dismissed for 315.
Leg-spinner Yasir Shah finished with six for 96.