Lanky paceman Shaheen Shah Afridi took a maiden five-wicket haul to lead Pakistan's fightback after Sri Lanka gained a crucial lead in the second Test in Karachi on Friday.
The 19-year-old paceman took 5-77 and was ably supported by new-ball partner Mohammad Abbas (4-55) to keep Sri Lanka down to 271 on a tricky National stadium pitch.
That gave the visitors a lead of 80 runs over Pakistan's first innings total of 191.
By the close of second day's play Pakistan had wiped off 57 of the deficit for no loss but still trail by 23 runs with all 10 wickets in hand and three days to play.
Opener Abid Ali - who became the first batsman ever to hit a debut hundred in both Test and one-day international in the first match in Rawalpindi - was unbeaten on 32 and Shan Masood on 21, not out.
The first Test in Rawalpindi ended in a draw due to bad weather, leaving both teams to fight it out for the series win in Karachi.
The series is part of the ongoing World Test championship with nine teams competing. The top two teams will play the final in June 2021.
Sri Lanka fought through Dinesh Chandimal who made 74 and Dilruwan Perera who made a fighting 48 batting at number nine.
With his team wobbling at 80-5 in the morning, Chandimal built partnerships of 67 with Dhananjaya de Silva (32) for the sixth wicket, 37 for the seventh wicket with Niroshan Dickwella (21) and then another 51 with Perera for the eighth.
Chandimal was finally dismissed by part-time spinner Haris Sohail, caught at backward point after he mistimed a cut. He hit ten boundaries in his 143-ball knock.
The extended two-and-a-half hour first session belonged to Pakistan who took three early wickets after Sri Lanka resumed at 64-3.
It were Abbas and Shaheen who rattled the Sri Lankan batting.
Abbas had nightwatchman Lasith Embuldeniya caught in the slip for 13 before left-armer Afridi dismissed Angelo Mathews, also for 13.
De Silva, who scored a century in the first Test, batted with grit to frustrate Pakistan and take Sri Lanka to 170-6 at lunch.
Shaheen broke the stand by luring De Silva into hooking straight into the hands of deep square-leg fielder Abbas, who held a running catch.
Perera also added an invaluable 36 for the ninth wicket with Vishwa Fernando to increase Sri Lanka's lead before Shaheen took the last two wickets in three balls.