Moeen Ali struck a late counter-punch for England just as Sri Lanka threatened to take control on day three of the second Investec Test at Headingley.
Moeen, the off-spinning all-rounder, was called on to bowl only one over in the first 55 of the tourists' second innings before being tossed the ball with master batsmen Kumar Sangakkara and Mahela Jayawardene setting firm foundations.
But the 27-year-old pinned Sangakkara lbw shortly after he had equalled the world record of seven consecutive Test half-centuries and then bowled Lahiru Thirimanne for a duck with a fine delivery.
Barring his intervention the hosts would be in much deeper trouble, but Sri Lanka will still be happy with their score of 214 for four and a 106-run lead, not least with Jayawardene (55no) and Angelo Mathews (24no) still at arms.
With the series up for grabs in the next two days, an England win is still possible too but Moeen's success will have Rangana Herath licking his lips at the prospect of fourth-innings carnage.
The day began with Shaminda Eranga and Mathews tearing up England's script for the morning session.
At 320 for six overnight they had the chance to build an imposing lead but settled for 108 after being undone in just 11.5 overs by intelligent seam bowling.
Eranga, in full control of the swinging ball, had Chris Jordan snapped up in the slips for 17 and ended the innings with a short ball that James Anderson fended straight back to him.
In between Mathews took two wickets of his own en route to career-best figures of four for 44.
Having first accounted for Stuart Broad he persuaded one to jag in dramatically to Liam Plunkett and topple middle stump.
Matt Prior's 27no was England's only real response, lit up by a pick-up six off Eranga shortly before Anderson's demise.
Conditions were ripe for England's bowlers to respond in kind, with plenty of assistance on offer amid gathering clouds.
But in 12 overs before lunch they went wicketless.
Anderson and Broad were both guilty of failing to engage the Sri Lankan openers around off stump, but each teased a nick from Dimuth Karunaratne before the break.
Anderson's flew straight to Jordan at second slip only to be fumbled to the floor, while Broad's squirted wide of the three-man cordon.
That aside, England went either too short or too wide.
That pattern continued until the 21st over when Plunkett removed Kaushal Silva with his eighth delivery.
There was no mystery when the moment came but it was full, fast and tempting enough to edge behind.
Plunkett's first ball to Sangakkara was played uncomfortably, but a set of five wides and two inviting half-volleys soon settled the batsman.
All the while, England's lead was evaporating.
It was down to just 15 when Karunaratne departed for a flaky but valuable 45, with Plunkett again responsible.
He dug one in at Karunaratne's body, flicking the glove on the way through.
The opener mistakenly called for a review but was in the pavilion when Sangakkara and Jayawardene reached tea just nine behind on 99 for two.
Sangakkara's fourth four, forcing Plunkett through extra cover, took Sri Lanka ahead and the partnership quickly assumed a foreboding air.
With Moeen grazing in the outfield, the four-man seam attack were chasing shadows.
Jayawardene brought up the 50 stand with a cut off Broad, then came Sangakkara's own record-equalling half-century with a legside nudge.
The only other men to have hit seven 50s in a row at this level are West Indians Everton Weekes and Shivnarine Chanderpaul and former England coach Andy Flower.
Eventually, Moeen was summoned back into the action and the reaction was instant.
Sangakkara was first in his sights, propping forward and trapped lbw by one that spun in and hit in line.
He was surprised enough to signal for DRS, but technology only confirmed Moeen's success.
There was another two balls into his next over, Lahiru Thirimanne bowled for a duck and completing a series return of four runs in as many innings.
The delivery was good enough for a player in better form, drawing him in with drift then leaving off the pitch.
Another wicket would have been huge but Jayawardene and Mathews gave no hint of vulnerability before stumps.