England set Sri Lanka a daunting victory target of 327 in the third and final Test and then reduced the hosts to 53 for four wickets to stay on course for a 3-0 series sweep on Sunday.
The tourists, who had taken a 96-run first-innings lead, overcame a top-order collapse of their own to post 230 all out in their second innings on day three of the contest.
Their spinners then wrecked the Sri Lankan top order to drive home the advantage at the Sinhalese Sports Club.
For the hosts, Kusal Mendis was batting on 15 at stumps with Lakshan Sandakan on one at the other end with Sri Lanka staring at a series whitewash.
Earlier, resuming on 3-0 and with an overall lead of 99, England lost Keaton Jennings leg before wicket for one off the first delivery of the day from Dilruwan Perera (5-88), which seemed to unhinge their top order.
The off-spinner dismissed Rory Burns for seven in an identical manner and substitute fielder Kaushal Silva took a sharp catch at short leg to dismiss Jonny Bairstow, who followed his first innings 110 with 15 in the second.
England's crisis deepened further when captain Joe Root offered a return catch to Malinda Pushpakumara to depart for seven, before Sri Lankan sloppiness and a solid middle order partnership worked in the tourists' favour.
Jos Buttler had reached 27 when he was given out leg-before to Dhananjaya de Silva, but the batsman managed to overturn the decision after replays confirmed the ball would have sailed over the stumps.
Stokes had an even more eventful and fortuitous stay before he was finally dismissed for a vital 42-run contribution.
The all-rounder was first caught at cover for 22 and then in the slip after adding 10 more runs but survived both times after replays confirmed spinner Sandakan had overstepped.
The wrist-spinner went on to dismiss Buttler but the hosts looked demoralised after his no-ball nightmares allowed England's overall lead to swell towards an almost impossible target for the side batting fourth.
Ben Foakes remained not out on 36 as the home spinners shared 10 English wickets among them for the second time in the match.
Their batting colleagues, however, let them down again with the Sri Lankan top order coming quickly unstuck in their chase.
Off-spinner Moeen Ali dismissed both the openers, Danushka Gunathilaka and Dimuth Karunaratne, and left-arm spinner Jack Leach sent back de Silva.
Angelo Mathews then played a reckless pull shot to depart for five with a premature defeat looming.
PIX: The star performers for India in Sydney
Syed Modi final: Erratic Saina stunned by Chinese youngster
PHOTOS: Krunal, Kohli shine as India down Australia; series ends 1-1
Like Mithali, I too was dropped at my peak: Ganguly
Why was Mithali dropped? COA likely to summon captain Harmanpreet...