Colombo - Sri Lanka require 153 runs for a series-levelling victory after Pakistan rode Azhar Ali's obdurate century before being all out for 329 on day four of the second Test on Sunday.
Heavy rain washed out the entire final session, leaving Sri Lanka with three sessions on Monday to score those runs and go into the third and final Test, starting on Friday, on equal terms.
Ali scored a painstaking 117 off 308 balls but Pakistan lost six second-innings wickets after lunch, the last five going for 28 runs.
Dour display
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.
Resuming on 171 for two, Ali led Pakistan's reply with a dour display of resolute batting despite losing senior batsmen Younus Khan (40) and captain Misbah-ul-Haq (22) in the morning session.
Sri Lanka skipper Angelo Mathews made the breakthrough when he induced Younus 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.
He took two runs off Chameera and was celebrating his hundred even though the third umpire was still checking whether he had been run out by Mathews' direct throw from mid-off.
Miss Test
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.
Wahab Riaz (six) displayed no less grit, coming out to bat with a fractured hand and was the last Pakistani batsman to be out.
Riaz, who was hit on the left glove by a Chameera bouncer in the first innings, will miss the third Test and is doubtful for the five-match one-day series that follows.
The scoreboard as supplied by AFP:
Pakistan 1st innings: 138 (Mohammad Hafeez 42, Tharindu Kaushal 5-42, Dhammika Prasad 3-43)
Sri Lanka 1st innings: 315 (K. Silva 80, A. Mathews 77, Yasir Shah 6-96)
Pakistan 2nd innings (overnight 171-2):
Mohammad Hafeez c Sangakkara b Mathews 8
Ahmed Shehzad c Chandimal b Prasad 69
Azhar Ali st Chandimal b Herath 117
Younis Khan c Chandimal b Mathews 40
Misbah-ul Haq lbw b Prasad 22
Asad Shafiq c Chandimal b Chameera 27
Sarfraz Ahmed c Chandimal b Prasad 16
Yasir Shah b Prasad 0
Zulfiqar Babar not out 7
Junaid Khan c Chandimal b Chameera 3
Wahab Riaz lbw b Chameera 6
Extras (b2, lb2, w5, nb5) 14
Total (all out, 118.2 overs) 329
Fall of wickets: 1-9 (Hafeez), 2-129 (Shehzad), 3-202 (Younis), 4-234 (Misbah), 5-274 (Shafiq), 6-301 (Sarfraz), 7-303 (Yasir), 8-313 (Azhar), 9-323 (Junaid), 10-329 (Wahab)
Bowling: Prasad 29.3-3-92-4 (w1), Mathews 11-5-15-2, Herath 34-7-89-1 (w3), Chameera 18.5-1-53-3 (w1, nb3), Kaushal 25-3-76-0 (nb2)
Pakistan lead by 152 runs
Toss: Pakistan
Umpires: Richard Illingworth (ENG) and Sundaram Ravi (IND)
TV umpire: Paul Reiffel (AUS)
Match referee: Chris Broad (ENG).