England picked up five wickets in the morning to bowl out the touring side for 288 and close in on a series whitewash but Sri Lanka hit back, claiming three quick wickets to give themselves a chance of a consolation victory.
Sri Lanka, resuming on 162 for one, lost Kusal Mendis, Kaushal Silva and Angelo Mathews inside the first 40 minutes to an inspired England pace attack led by Chris Woakes and Stuart Broad.
Woakes struck first, trapping Mendis lbw for 25 and Broad forced Silva to edge a catch to wicketkeeper Jonny Bairstow without adding to his overnight score of 79.
Mathews, on three, nicked a rising Woakes delivery to Joe Root at fourth slip to leave Sri Lanka reeling at 169 for four.
Lahiru Thirimanne and Dinesh Chandimal set about repairing the damage in a gritty fifth-wicket partnership of 33 but Steven Finn removed both batsmen before lunch.
The tall fast bowler dismissed Chandimal lbw for 19 and Thirimanne, on 17, drove loosely at a wide delivery and gave Root another catch at third slip.
Kusal Perera and Rangana Herath shared a stubborn seventh-wicket partnership of 71 to frustrate England before Broad bowled Herath for 31 and after Perera edged James Anderson to Bairstow for 42 Sri Lanka folded quickly.
England captain Alastair Cook was unable to open the innings after he was struck on the knee by the ball when fielding close to the wicket.
Nick Compton and Alex Hales added 45 for the first wicket without undue alarm before Compton, on 19, edged Shaminda Eranga to wicketkeeper Chandimal, another failure in a poor series that will almost certainly cost him his place in the team.
Root was bowled by Nuwan Pradeep for four, the ball keeping very low, and James Vince shouldered arms to his first delivery and was also bowled.
Alex Hales and Bairstow steadied the ship with a partnership of 51.
Bairstow, who made 167 not out in the first innings, continued his rich vein of form to make 32 runs but he played a tired shot at Pradeep and was bowled middle stump.
Hales survived to reach the close on 41 with nightwatchman Finn on six.