Dhananjaya de Silva and Angelo Mathews helped Sri Lanka to overcome a top-order collapse and reach 242-6 on Day one of the opening Test against Pakistan in Galle on Sunday.
Home captain Dimuth Karunaratne's decision to bat appeared to have backfired after Shaheen Afridi dealt three blows in the morning session and Sri Lanka slumped to 54-4.
De Silva, batting on 94, and Mathews then forged a 131-run partnership to steady the ship in the first match of the two-Test series.
Mathews fell at the stroke of tea after making 64, but De Silva went on to stitch together another 50-plus partnership with Sadeera Samarawickrama, who made 36 before Agha Salman dismissed him with the final delivery of the day.
Earlier, Afridi made an emphatic return to Test cricket after Sri Lanka elected to bat at a venue where they have played six of their last eight Tests, winning four of them.
Afridi had suffered a hamstring injury at the same stadium last year and the left-arm fast bowler did not have to wait long to claim his 100th Test wicket.
In his second over, Afridi reached the milestone when he induced a thick edge from opener Nishan Madushka, who made four, and Sarfaraz Ahmed took the catch behind the stumps.
Rain interrupted play after 5.5 overs but Afridi mowed down Sri Lanka's top order after play resumed as Kusal Mendis (12) perished in the slip and Karunaratne (29) fell caught behind.
Naseem Shah dismissed Dinesh Chandimal, who made one, before Mathews and de Silva bailed out Sri Lanka.
Abrar Ahmed removed Mathews with the final delivery before the tea break but de Silva, who hit three sixes and 10 fours in his stellar knock, remained on course for his 10th Test hundred.