Dhammika Prasad's dramatic four-wicket burst following a hundred from skipper Angelo Mathews left Sri Lanka on the brink of victory in the second Test against England at Headingley on Monday.
England were 57 for five at stumps on the fourth day, needing a further 293 runs to reach their imposing victory target of 350.
The most England have previously made in the fourth innings to win a Test is 332 for seven against Australia at Melbourne in 1928/29.
And only one team have made more in the fourth innings to win a Test at Headingley -- Australia's 404 for three against England in 1948.
Sri Lanka have won just two Tests in England and never claimed a series on English soil of more than one match.
But, having held out for a draw in the first Test at Lord's with just one wicket standing, Mathews's men were now on course for a memorable victory.
Earlier in the day, England bowled too short and Prasad, recalled in place of the dropped Nuwan Kulasekara, showed them the value of pitching the ball up.
England were making steady progress at 39 without loss when Prasad, the fifth bowler used by Mathews, struck twice in his first over.
With his third ball he induced England captain Alastair Cook to bottom edge a pull onto his stumps.
That meant the left-handed opener's run without a Test century since he scored the last of his England record 25 hundreds against New Zealand at Headingley last year now extended to 24 innings.
And next ball Prasad's excellent full-length delivery had Gary Ballance plumb lbw for a duck.
Ian Bell prevented a hat-trick but Prasad was in the wickets again when Australia-born opener Sam Robson, who in the first innings had made a maiden Test century, drove loosely outside off stump and was caught by second slip Mahela Jayawardene for 24.
Prasad then surpassed his previous Test-best of three for 82 against Pakistan in Colombo six years ago when he squared up Bell with a fine delivery that clipped the top of off-stump.
England were now 52 for four, with Prasad having taken four for 10 in 24 balls.
And the 31-year-old would have had two more wickets had not both nightwatchman Liam Plunkett and Joe Root successfully challenged caught behind decisions given by New Zealand umpire Billy Bowden.
But to what became the last ball of the day, Plunkett fell for nought when he chipped a gentle catch to cover off left-arm spinner Rangana Herath.
Mathews's hundred was the centrepiece of Sri Lanka's second innings 457.
It was only his fourth century in 40 Tests but third since he became captain last year.
And it meant the all-rounder, whose knock surpassed his 157 not out against Pakistan at Abu Dhabi last year, had set new personal Test-bests with both bat and ball in this match after the seamer took four for 44 in England's first innings.
Mathews received excellent support from Herath (48) in an eighth-wicket stand of 149.
The pair were only separated on the stroke of tea when Mathews, in search of a single for his 150, sent back Herath back only for the non-striker to be run out by Root's direct hit from mid-on.
Mathews did give a chance on 87 when fast bowler Plunkett dropped a hard-hit return catch.
Sri Lanka resumed Monday on 214 for four, a lead of 106, with star batsman Jayawardene 55 not out and Mathews 24 not out.
After a stand of 92 between Mathews and Jayawardene, out for a typically elegant 79 in probably his last Test innings in England, Sri Lanka briefly faltered at 277 for five when Plunkett took two wickets in two balls.
An angry Mathews threw his bat down in frustration but he responded by driving Plunkett for a ferocious six over mid-wicket.
A single off Stuarrt Broad saw Mathews to his hundred.
England had seemed more concerned trying to get Herath on strike than dismissing Mathews, with Cook rarely putting pressure on his Sri Lankan counterpart with attacking fields.
Mathews's impressive innings of more than five hours, including 247 balls with 25 fours and a six, ended when he chipped a James Anderson full-toss to mid-wicket.