Sri Lanka require 153 runs for a series-levelling victory after Pakistan rode Azhar Ali's ninth Test century before being all out for 329 on day four of the second Test.
Heavy rain washed out the entire final session, leaving Sri Lanka with three sessions on Monday to reach the target and go into the third and final Test, starting on Friday, on equal terms.
Ali scored 117 off 308 balls but Pakistan lost six second-innings wickets after lunch, the last five going for 28 runs at the P Sara Oval.
Dhammika Prasad (4-92), who initially bowled without much luck, was the pick of the Sri Lankan bowlers, while Dushmantha Chameera (3-53) also impressed.
Infographic: Who rules the world of sport?
Resuming on 171 for two, Ali led Pakistan's reply with a dour display of resolute batting despite losing senior batsmen Younis Khan (40) and captain Misbah-ul-Haq (22) in the morning session.
Sri Lanka skipper Angelo Mathews made the breakthrough when he induced Younis to edge a delivery behind and Prasad then trapped Misbah leg before.
The Pakistan skipper reviewed the decision but could not get the verdict overturned.
Ali took 266 balls to bring up his ninth test century, a knock of unflattering strike rate as well as unwavering determination spread over eight-and-half hours.
Ali was adjudged leg before to Prasad on 114 but the batsman reviewed the decision and got it overturned.
He could only add three more runs before falling to spinner Rangana Herath.
Pakistan won the opening Test in Galle by 10 wickets.
Pakistan 138 all out and 329 all out (Ali 117, Prasad 4-92)
Sri Lanka 315 all out (Silva 80, Shah 6-96)
|Five of Azhar's nine Test centuries have come in the second-innings [Reuters]
Source: Al Jazeera and agencies