Seamer Dhammika Prasad claimed four wickets to put Sri Lanka on top in the second Test in Colombo on Sunday despite a defiant century from Azhar Ali.
Pakistan, who trailed by 177 on the first innings, were bowled out for 329 in their second knock by tea on the fourth day to leave the hosts a target of 153 runs to level the three-match series.
But heavy rain washed out play in the final session, setting the stage for an absorbing final day on a wearing P Sara Oval - provided the forecast of more bad weather proves wrong.
Pakistan won the first Test in Galle by 10 wickets.
Azhar anchored the Pakistan innings with a watchful 117, his ninth Test century, but found little support at the other end as the last six wickets tumbled for 55 runs.
Wicket-keeper Dinesh Chandimal pouched five catches and also brought off a stumping, while debutant fast bowler Dushmantha Chameera claimed three wickets in an impressive Sri Lankan display in the field.
Azhar was reprieved twice during his marathon vigil that lasted eight hours and 33 minutes, in which he faced 308 deliveries and hit just six boundaries.
Azhar had added four runs to his overnight score of 64 when he was dropped by a diving Kumar Sangakkara at first slip off Prasad, a catch that Chandimal could have attempted.
When he moved to 114, Azhar was saved by a television review after umpire Sundaram Ravi had declared him leg-before off Prasad.
But the Pakistan number three was stumped soon afterwards when he tried to hit left-arm spinner Rangana Herath out of the stadium.
Azhar said Pakistan were not out of the Test despite the modest target given to Sri Lanka.
"This kind of a total can be a bit dodgy because we can come back with a few early wickets," he said. "We could have been in a better position if we had not lost wickets at a crucial stage.
"We should have got a lead of around 230 or 240. Still, there are runs on the board to defend. There is a lot in this pitch for spinners and if they bowl in the right areas, anything can happen tomorrow (Monday)."
Pakistan will miss pace spearhead Wahab Riaz, who batted on Sunday but is unlikely to bowl due to a hairline fracture in his left hand sustained while batting on the opening day.
Sri Lanka's Prasad said the target of 153 runs would not come easily, but insisted his team had the batsmen to get them home.
"If we bat positively, I think we can reach there easily," he said, adding a bit of advantage was lost due to the rain in the final session.
Pakistan, who started the day on 171-2, lost the important wickets of Younis Khan and skipper Misbah-ul Haq in the morning session to go to lunch at 244-4.
Younis, who had hoped for a big innings in his 100th Test appearance, had scored 40 when he edged Angelo Mathews to Chandimal, ending a 73-run stand for the third wicket with Azhar.
Misbah, seemingly disturbed by a band playing in the stands, requested the umpires to stop the music, saying it upset his concentration.
The band obliged but Misbah did not last long at the crease as he was trapped leg-before by Prasad for 22.
Pakistan lost Asad Shafiq after lunch when he was caught down the leg-side by Chandimal off Chameera for 27, triggering a collapse from a comfortable 274-4.
The third and final Test begins in Pallekele on July 3.