Chasing a target of 131 set by Sri Lanka in the first Test at Galle, Pakistan ended the fourth day at 48-3.
At the end of the fourth day, Imam-ul-Haq and Babar Azam were unbeaten on 25 and six respectively.
Pakistan need 83 more runs to win the match on the final day and take a 1-0 lead in the two-match series.
Prabhat Jayasuriya took two wickets of Pakistan’s top-order after dismissing Abdullah Shafiq (8) and Shan Masood (7).
Meanwhile, nightwatchman Nouman Ali was run out while attempting a suicidal second run.
Sri Lanka were bowled out for 279 in their second innings at the start of the day, which meant that Pakistan were set a target of 131 to win the match.
Abrar Ahmed and Nauman Ali were the main destroyers for Pakistan with three wickets each. Meanwhile, Shaheen Afridi and Agha Salman bagged two wickets each.
Dhananjay de Silva, who scored a century in the first innings, top-scored for the home side once again with 82 runs.
Having lost three wickets in the second session, Sri Lanka were 210-6 with a lead of 61 runs at tea.
Nishan Madushka was dismissed after scoring 52 runs with the help of seven fours and a six. Dinesh Chandimal (28) and Sadeera Samarawickrama (11) also could not stay at the crease for long.
In the post-lunch session, Agha Salman took two wickets, while Nauman bagged one.
Earlier, the home side lost three wickets in the morning session and slumped to 94-3 at lunch.
All three wickets in the first session were taken by Pakistan’s spinners, with Nouman Ali taking two and Abrar Ahmed one.
Abrar dismissed Sri Lankan spinner Dimuth Karunaratne for 20, meanwhile, Nauman trapped Kusal Mendis in front of the stumps for 18.
At the end of the first session, Pakistan captain Babar Azam took a brilliant one-handed catch at first slip off Nauman and sent back Angelo Mathews (7).
Earlier, Saud Shakeel scored his maiden double century in Tests, helping Pakistan take a 149-run lead against Sri Lanka on the third day of the rain-affected opening match on Tuesday.
The visitors were bundled out for 461 in the final session on the third day after a disappointing ninth-wicket partnership of 94 between Shakeel, who remained unbeaten on 208, and Naseem Shah, who scored six off 78 balls.
The 27-year-old Shakeel, playing only his sixth Test, hit Dhananjaya de Silva for a boundary to bring up his double hundred and received a standing ovation.
“When Naseem Shah joined me, he said I have a chance to score a double hundred,” Shakeel told reporters after the marathon innings.
“A lot of credit goes to him for supporting me and not letting me panic.”
The hosts ended the day 14–0 after play was halted due to bad light.
At stumps, Nishan Madushka was batting on eight runs and captain Dimuth Karunaratne was batting on six runs.
Spinner Ramesh Mendis took five wickets, but Shakeel, along with the tailenders, shared a 52-run partnership for the seventh wicket with Nauman Ali, who made 25.
But his 177-run partnership with Agha Salman (83 runs) brought Pakistan back into the game after being bowled out for 101-5 in reply to Sri Lanka’s 312.
Shakeel said, “When I went out to bat, I wanted to attack. If I had tried to be defensive, we would have been bowled out for 150.”
“That’s why I attacked and was able to take the game deep.”
Sri Lanka coach Chris Silverwood said, “I don’t think we did our best with the ball. It was good to see Ramesh get the five wickets he deserved. As a unit we weren’t as good as we should have been.” Could have.”
“We managed to contain their run rate to some extent today, but unfortunately, we missed some crucial chances which cost us.”