England were advancing towards a 2-0 series win over Sri Lanka after spinners Jack Leach and Dom Bess changed the entire landscape of the second Test in Galle.
The duo drew a disappointing blank across 64 overs in the first innings of the match but stood up under pressure on day four, taking four wickets apiece as the hosts were bundled out for 126.
That left England chasing 164 for the win, a tricky fourth-innings target on a turning pitch but one that they made strong inroads on to reach 46 for one at tea.
Zak Crawley fell to the dangerous Lasith Embuldeniya, who had already top-scored with a free-hitting 40, but Dom Sibley (14no) Jonny Bairstow (17no) put the tourists in charge with a busy partnership.
The day began with the swift demise of England's innings, with five runs added before Dilruwan Perera had Leach lbw.
The pressure was on Leach and Bess, who had toiled without any notable success in the first half of the match, and they responded in style to pick up respective figures of four for 59 and four for 49.
Leach was into the game after a token four overs of seam from James Anderson and Sam Curran.
The left-armer sent down 228 balls without joy earlier in the match but struck gold with his second delivery here, Kusal Perera kneeling down in pursuit of a big slog sweep to fall lbw despite being struck on the midriff.
Trying to launch Bess over midwicket he was beaten through the air then lost his off stump as the ball spun sharply off the surface.
Captain Dinesh Chandimal hit two boundaries off Leach but could not resist going for a third, launching a swirling catch up in the air as Anderson steadied himself before a nerveless take dropping over his shoulder.
Niroshan Dickwella, fresh from his career-best 92, then drilled Bess to Dan Lawrence at cover for the latest example of muddled thinking.
Joe Root could have made the lunch equation even better but let a couple of chances slip at the end of the session, reprieving Ramesh Mendis and Dilruwan.
England continued their dominance after lunch, Dilruwan flicking Bess to Crawley at short-leg and Mendis becoming the latest victim of the sweep when he under-edged Leach into his boot. Jos Buttler was on hand to nip in front of the stumps and gather the catch.
Sri Lanka had barely threatened to reverse the pressure but Embuldeniya came from nowhere to chance his arm with a near run-a-ball 40.
There were six fours as well as a six from Leach but he was dropped twice, by Bairstow and Bess, before Root gambled on his own part-time spin to remove him and Asitha Fernando with successive deliveries.
Embuldeniya served up a full toss to give Crawley a cheap early boundary in the chase and the batsman was into double figures at a brisk rate as he decided not to box himself in.
With 13 to his name he got one he could do nothing with, unnerved by the flight and bested by the turn as he pinged a catch to gully.
Despite the loss, England did not stand still as Sibley and Bairstow continued chipping away.
Both men were profiting from some generous bowling on the pads and some curious fields, but there was intent too. Sibley middled a sweep for four, taking Root's lead, while Bairstow followed a reverse sweep with a big swing for six over long leg.
Sibley had a touch of luck too, twice surviving lbw appeals by the buffer of 'umpire's call'.