Adil Rashid sparked a dramatic Sri Lanka collapse and claimed career-best figures on day two of the third Test to leave England scenting a whitewash in Colombo.
A second-wicket stand of 142 between Dimuth Karunaratne (83) and Dhananjaya de Silva (73) put Sri Lanka on course for a first-innings lead after England were bowled out for 336 on Saturday.
Joe Root dropped Karunaratne and Dhananjaya on two and 42 respectively, so the captain must have been a relieved man after Sri Lanka capitulated from 173-1 to 240 all out.
Rashid (5-49) generated sharp turn to claim a second five-wicket Test haul thanks in no small part to Keaton Jennings, who took four catches at short leg - two of which were out of the top drawer.
Ben Stokes took 3-30 in a hostile spell as Sri Lanka folded in the final session and England were three without loss at stumps, leading by 99 and strong favourites to secure a 3-0 win.
The tourists added just 24 runs after resuming on 312-7, Moeen Ali falling for 33 and Lakshan Sandakan (5-95) completing a five-wicket haul with Rashid left unbeaten on 21.
Recalled paceman Stuart Broad was denied an early wicket when Root failed to snaffle a chance in the slips, Karunaratne breathing a sigh of relief as the ball ran away for four.
A moment of brilliance from Jennings gave Jack Leach a breakthrough, the opening batsman moving himself into the line of Danushka Gunathilaka's shot and somehow holding on under the helmet.
The positive Dhananjaya struck Leach for back-to-back boundaries when the spinner dropped strayed in line and length, Sri Lanka taking lunch on 74-1.
Dhananjaya was given a life when a juggling Root put him down to leave Broad frustrated again and the partnership passed the 100 mark when he swept Moeen to the boundary.
Karunaratne and Dhananjaya looked increasingly comfortable after bringing up their half-centuries, the number three finding the ropes eight times before Jennings took a more straightforward catch to finally end a long stand.
Rashid and Jennings combined again to see the back of Karunaratne just after tea and Stokes was rewarded for an excellent spell when Ben Foakes took a fine catch to remove the dangerous Angelo Mathews.
The procession of wickets continued, with Jennings showing lightning fast reactions to pluck a one-handed catch to dismiss Roshen Silva before Niroshan Dickwella was strangled down the leg side off Stokes.
Foakes was treated for a finger injury but remained behind the stumps as Sri Lanka fell to pieces, Kusal Mendis edging Rashid to Stokes at first slip.
Rashid could do no wrong, running out Sandakan with a direct hit and trapping Malinda Pushpakumara leg before after Stokes struck again, with Jennings and Rory Burns seeing off four overs in what could be a decisive final session.