Having battled hard to make 359 all out in their second innings, Sri Lanka gave themselves a glimmer of hope when Lasith Embuldeniya quickly removed England openers Dom Sibley and Zak Crawley.
The run out of captain Joe Root, who was called through for a single that was never on before falling over as he dived to unsuccessfully make his ground, left the tourists teetering at 20-3.
However, Jonny Bairstow and Dan Lawrence steadied the nerves, seeing England through to stumps without any further setbacks. The duo will resume on day five needing a further 36 to seal the series opener.
Sri Lanka will be left cursing their first-innings shortcomings with the bat, particularly after a second Test hundred from Lahiru Thirimanne underpinned a far-improved display second time around.
England did remove nightwatchman Embuldeniya early but were made to work hard for wickets after that, Jack Leach the pick of the attack as he finished with figures of 5-122.
Sam Curran eventually ended Thirimanne's defiance when the opener had 111 to his name, while the hosts were still in deficit when stand-in captain Dinesh Chandimal edged Dom Bess (3-100) to Root at first slip.
The same bowler accounted for Niroshan Dickwella, who made 29, but Angelo Mathews proved to be a familiar thorn in England's side.
Wicketkeeper Jos Buttler secured his first stumping in Test cricket as some smart glovework ended a lively cameo from Dilruwan Perera (24), while Mathews was the last man out midway through the final session.
The former Sri Lanka skipper had battled for nearly six hours before Leach tempted him into a leaden-footed drive, ending his resistance on 71. England appeared frenetic at the start of their chase on a dry, turning surface, but will still be confident of completing the job on Monday.
TON-DERFUL MOMENT FOR THIRIMANNE
Thirimanne's previous Test century also came at the same venue; he made 155 not out against Bangladesh back in March 2013. The left-handed opener may not have featured in this match had captain Dimuth Karunaratne not been ruled out with a fractured thumb, but he seized his opportunity.
In total, he faced 251 deliveries and hit 12 boundaries, helping at least restore some pride for Sri Lanka after they had been dismissed for 135 on a dismal opening day.
LEACH STICKS TO HIS TASK
Leach had not played in a Test since November 2019, since when an illness and the COVID-19 pandemic has restricted him to just two first-class appearances. The left-arm spinner could be forgiven for a little rustiness, then.
However, he stuck manfully to his task during the innings, sending down 41.5 overs to claim his second five-wicket haul in Tests. His other also came against Sri Lanka, at Pallekele back in November 2018.
For in-depth, objective and more importantly balanced journalism, Click here to subscribe to Outlook Magazine