Dinesh Chandimal and Angelo Mathews scored patient half centuries and combined in an unbeaten 99-run stand to lift Sri Lanka to 285-4 in its second innings at lunch on Friday, extending its lead to 106 against Pakistan in the first Test.
Chandimal resumed Day 4 on 24 and moved to 67 at the interval, while Mathews was unbeaten on 56 to revive Sri Lanka's second innings.
Pakistan had Sri Lanka in trouble at 186-4 on the third day when fast bowler Bilawal Bhatti claimed key wickets of experienced Kumar Sangakkara (55) and Mahela Jayawardene in quick succession, and Junaid Khan had opening batsman Kaushal Silva (81) caught behind.
But Pakistan pacers struggled to get through to the defenses of Chandimal and Mathews and even the second new ball didn't bring them any success in an extended 2½ -hour first session due to Friday prayers.
Chandimal hit eight boundaries and faced 124 balls, while Mathews' 125-ball innings contained six boundaries and a six over mid-on off Saeed Ajmal.
Both batsmen showed a lot of grit against the Pakistan pace trio of Khan, Bhatti and Rahat Ali while offspinner Ajmal also couldn't find much turn to bother batsmen.
Just before play started, Pakistan wicketkeeper Adnan Akmal was ruled out of the remainder of the test series after fracturing his index finger.
Akmal was hit on his left index finger when he caught Silva in the last over of the third day on Thursday.
The Pakistan Cricket Board said in a statement on Friday that Sarfraz Ahmed will be flown in for the remaining two matches in the series.
Ahmed played in last year's three-test series in South Africa before Akmal regained his place in the national team.
Younis Khan replaced Akmal behind the wickets when play resumed on the fourth day.