Agha Salman waged a lone battle, scoring 62 from 126 balls on a surface offering ample help to the slow bowlers.
The right-hand batsman looked set to take Pakistan to close of play when was caught at slip at the stroke of stumps with the visitors still trailing Sri Lanka's first innings score of 378 by 187 runs.
“It’s been my dream to play for Pakistan in Test match cricket,” Salman said. “Glad that I was able to score a half-century in my second game. Disappointed that I couldn’t see through today.
“A nice partnership was building and our plan was to see off the day and start fresh tomorrow. But that’s cricket. It’s a still good wicket to bat and we have plenty of batters who are capable of getting us closer to Sri Lanka’s total.”
Ramesh Mendis also enjoyed a day to remember. He first chipped in with a lower order cameo and then claimed 3-42 to put Sri Lanka on course for a significant first innings lead.
Batting at No 9, Mendis contributed 35 in Sri Lanka's significant first-innings score. The off-spinner then returned to wreck Pakistan's middle order.
As was the case in the first innings of the opening Test, the home bowlers dictated the day's play.
Sri Lanka right-arm quick Asitha Fernando, who had been sidelined after testing positive for Covid-19, had a good comeback as he dismissed Abdullah Shafique with the second ball of the innings.
Shafique poked at a delivery he could have left alone and ended up getting a thick inside edge on to his stumps
Sri Lanka's spinners struck three times in the second session, including the scalp of skipper Babar Azam.
Left-arm spinner Prabath Jayasuriya (2-59) bowled Azam for 16 on a turning delivery that got the edge of the star batsman's willow to crash on to the stumps.
Opener Imam-ul-Haq attempted to rebuild the innings with Mohammad Rizwan but Dhananjaya de Silva broke through with his off-spin to send back Imam on 32.
De Silva is standing in as captain in place of Dimuth Karunaratne, who did not take the field in the Pakistan innings because of back pain. Sri Lanka team manager Mahinda Halangoda said he is doubtful for the remainder of the game.
Wicketkeeper Rizwan hit a few boundaries to counterattack but Mendis trapped him lbw for 24 and a review did not help the wicketkeeper-batsman, with replays showing the ball would have hit leg stump.
From there, Salman attempted to resurrect the innings. Mohammad Nawaz and Yasir Shah showed decent application as Pakistan edged closer to the 200-run mark.
But just as it seemed the worst was over, Salman edged Jayasuriya to slip in the last over of the day to put Sri Lanka well on top.
Shah survived 61 balls, and an lbw decision against him that was reversed, for his 13 not out.
Earlier, the hosts resumed on 315-6 in former captain Angelo Mathews' landmark 100th Test, with overnight batsman Niroshan Dickwella making 51 and a useful cameo by Mendis.
Fast bowler Naseem Shah and leg-spinner Yasir Shah claimed three wickets each to end Sri Lanka's innings in the first session.
Opener Oshada Fernando (50), Dinesh Chandimal (80) and Mathews (42) hit key knocks on Sunday after the hosts, who trail the two-match series 1-0, elected to bat first.
A 92-run start by the openers, followed by a fourth-wicket stand of 75 between Chandimal and Mathews, lay the foundations for the total on a pitch expected to turn big from Day 3.
“We have played four back-to-back games here and all four wickets were different to each other,” Dickwella said. “I would say this is the best wicket to bat. It’s still a good pitch to play. Why we were able to get seven wickets today was because we bowled really well.”
The men in green won the first Test in dramatic circumstances, chasing down a record 342 at Galle, which is hosting both matches after political turmoil in Colombo.