Pakistan leg-spinner Yasir Shah once again did the damage – adding to his 17 wickets in the first two Tests – with 4-74.
Pakistan won the first Test in Galle, before Sri Lanka levelled the series in Colombo.
Sri Lanka were sent into bat after Pakistan captain Misbah-ul Haq won the toss for the third time in a row.
Left-handed opener Karunaratne (130) anchored the innings and put on 91 runs for the second wicket with Upul Tharanga, after Rahat Ali (2-74) claimed the early scalp of Kaushal Silva, caught behind, for nine.
Yasir grabbed a wicket ??? Tharanga edging to Younis Khan at slip ??? shortly after lunch, and it would be the first of three wickets to fall for just 31 runs as Sri Lanka suffered a mini-collapse.
Lahiru Thirimanne and skipper Angelo Mathews then fell in successive overs to Yasir as Sri Lanka slipped to 137-4.
Jehan Mubarak, recalled to the Test side after an almost eight-year absence, helped steady the ship with Karunaratne ??? who went through to three figures ??? adding 67 for the fifth wicket before he was stumped off Yasir for 25.
Karunaratne was then also stumped, finally falling to the part-time spin of Azhar Ali (2-35), as Azhar took two wickets in two balls, with Dhammika Prasad departing for a first-ball duck.
Dinesh Chandimal was the final wicket to fall on the day, lbw to Rahat for 24, as Sri Lanka closed on 272-8.