Gary Ballance's maiden Test century and a crucial 78-run seventh wicket stand with Chris Jordan saved England's blushes after Sri Lanka had torn through the top off their batting line-up on the fourth day of the opening Test at Lord's on Sunday.
Shaminda Eranga and Rangana Herath left the hosts wobbling on 117 for five at tea, while Nuwan Kulasekara removed Matt Prior soon after the interval to raise Sri Lankan hopes of a first Test win at the home of cricket in seven attempts.
However Ballance's century in his second Test, brought up with a six over square leg, and Jordan's positive approach on his debut took England's lead to 389 at stumps.
They displayed the discipline lacking from some of their team mates whose dismissals had raised the possibility of a result on a pitch that appeared to favour a draw.
England, should they decide against declaring, will commence the fifth and final day on 267 for eight with Balance 104 not out and Liam Plunkett on two.
Earlier in the day, Sri Lanka captain Angelo Mathews, who along with Kumar Sangakkara (147) helped Sri Lanka pass the follow-on target in Saturday's evening session, brought up a well-deserved third Test century when he smashed a James Anderson full toss through extra cover.
The attack-minded Mathews was unable to push on, however, falling lbw to Plunkett for 102 from the next ball he faced.
Jordan wrapped up the innings for 453 in rare fashion, causing Nuwan Pradeep (4) to strike the wickets with his bat after being struck on the shoulder by a bouncer.
Alastair Cook and Sam Robson eased through to lunch but did not last much longer, with the captain feathering an edge on 28 through to Prasanna Jayawardene off Eranga, who had opened his spell with three consecutive maidens.
Cook has not reached three figures in his last 22 Test innings and will rue missing the chance to build some confidence on a placid pitch, albeit one that may offer some encouragement for the spinners on the final day.
Eranga doubled his wicket tally in his next over, getting through Robson's defences to complete a tough test debut for the Middlesex 24-year-old who was dismissed for one first time out and only managed 19 on Sunday.
Ian Bell, playing his 99th Test, went the same way as the hosts teetered at 69 for three, Eranga having taken three wickets for three runs off 21 balls.
Ballance and Joe Root appeared to have knuckled down before left-arm spinner Herath caught the latter, who compiled his maiden double-century in England's first innings, on the back leg dead in front.
Moeen Ali, making his debut alongside Jordan and Robson, hit the first ball he faced back down the pitch for four but Herath found a gap through bat and pad to shatter the stumps with his next delivery, while Prior tamely cut Nuwan Kulasekara to Lahiru Thirimanne in the gully after tea.
Ballance struggled to find the gaps early in his innings, at one stage going 26 balls without troubling the scorers in the lead up to tea, but he fought his way through to a half-century to stem the flow of wickets alongside Jordan, who fell for 35 after looping a ball from Herath to Sangakkara at mid-off.
Ballance then combined with Stuart Broad to effectively bat Sri Lanka out of the match.
Image: England’s Gary Ballance celebrates after reaching his century during Day 4 of first Test against Sri Lanka at Lord's.
Photograph: Gareth Copley/Getty Images