Red hot Dinesh Chandimal struck his second successive half-century to take Sri Lanka's lead past 300 and thwart the Pakistan attack on day three of the opening Test on Monday.
The hosts were 329 for nine when bad light stopped play for the day in Galle.
Chandimal, on 86, and Prabath Jayasuriya, on four, were batting at close of play with Sri Lanka leading by 333 in their second innings.
Mohammad Nawaz claimed his maiden five-wicket haul and combined with fellow spinner Yasir Shah, who took three, to rattle the opposition middle-order in the second session.
But Chandimal, who struck blazing form with his maiden double century -- 206 not out -- in his team's series-levelling Test win over Australia last week, stood firm in another lower-order show of defiance after the hosts slipped to 235-7.
"Chandi batted so well in the first innings too. He has done what the team needs," Kusal Mendis, who hit 76, said of the veteran batsman.
"This is a good total but if we get to that 350 mark, the bowlers will have lot of runs to play with.
"Tomorrow I think the wicket will get even better for spinners once you get the roller on," he added.
Chandimal reached his fifty and put on 41 runs with Maheesh Theekshana for the ninth wicket in a repeat performance from the hosts, who had hit back from 133-8 to post 222 in their first innings.
- Dream return for Nawaz -
Earlier Kusal and opener Oshada Fernando scored 64 and put on a key third-wicket stand of 91 to fight back after an early wicket in the morning session.
Oshada reached his sixth Test fifty in the first session but fell to Yasir on the second ball after lunch.
Kusal raised his fifty and took on the opposition attack with a few boundaries before Yasir bowled him with an unplayable delivery that pitched outside leg and turned to hit the top of off stump.
Nawaz, who is making a Test comeback after nearly six years and playing his fourth five-day match, kept chipping away and got key wickets including Angelo Mathews and Niroshan Dickwella.
"It's every bowler's dream to get a five-for in Test cricket and the same goes for me," Nawaz, who previously played just three Tests in his team's 2016 West Indies tour, told reporters.
"I just concentrated on transferring my preparation from the nets to execute it in the middle and keep my basics right. We needed to bowl well, especially on this pitch."
Nawaz, an all-rounder who bats left-handed, hoped the target would not be much more than the current total, adding that would be "achievable" with two or three good partnerships.
He got nightwatchman Kasun Rajitha on the third ball of the day to set things rolling for Pakistan, but the Sri Lankan batsmen kept coming back on a pitch that is expected to offer more turn to the spinners come day four.
In a keenly contested match of tail end fights, Pakistan had also hit back to post 218, riding on skipper Babar Azam's 119 as he batted with his own lower order on day two.