Sri Lanka's Roshen Silva held the fort with a stubborn 85 to secure a 46-run first innings lead over England on the second day of the second Test on Thursday.
Shortly before stumps in Pallekele the hosts, down 1-0 in the three-match series, were bowled out for 336 in reply to England's 290 with stand-in captain Suranga Lakmal unbeaten on 15.
The visitors were yet to open their account after nightwatchman Jack Leach faced six balls from Dilruwan Perera in the final over of the day. Rory Burns was accompanying Leach at close of play.
Adil Rashid had struck twice after lunch to raise the tourists' hopes of securing a crucial first innings lead on a seemingly turning pitch.
But Roshen built crucial partnerships including a 56-run ninth wicket stand with Akila Dananjaya as the hosts edged past England's total.
Dilruwan made 15 before falling lbw to Leach while Dananjaya frustrated England before falling to Moeen Ali, also leg before for 31.
England had made inroads into the Sri Lankan middle order through some brilliant fielding by Ben Stokes before lunch but Roshen frustrated the opposition bowlers for the rest of the day.
Dimuth Karunaratne, who made 63, put on 96 for the third wicket with Dhananjaya de Silva, who hit 59, to steady the innings after they had slipped to 31-2 early in the day.
But Stokes, who on Wednesday had failed with the bat as England's new No 3, broke the partnership when he pounced to run out Karunaratne with a direct throw from gully.
The star all-rounder then took a stunning one-handed catch low to his left at first slip to dismiss Kusal Mendis for one off the slow left-arm spin of Leach.
England's first innings total was 285 but Sri Lanka were docked five runs after the umpires deemed that Roshen did not ground his bat properly while taking a run.