There were more than 20 overs remaining when England No 11 James Anderson came into bat. (Agencies)
But he survived for 55 balls on nought until, off the penultimate delivery of the match, he gloved paceman Shaminda Eranga to Rangana Herath at leg gully.
Just as Sri Lanka had staved off defeat by one wicket in the drawn first Test at Lord's, it seemed England might do likewise in Leeds.
But Sri Lanka No 11 Nuwan Pradeep only had to survive five balls at Lord's.
Anderson had defied Australia's attack for 53 balls when England clung on for a draw with one wicket standing in the 2009 Ashes Test in Cardiff and so nearly did the same on this occasion.
Defeat was tough on England's Moeen Ali who batted for six-and-a-half hours while making 108 not out - his maiden Test century.
England, set 350 for victory, were bowled out for 249 on the fifth and final day as Sri Lanka won a Test on English soil for only the third time in their history following victories at The Oval in 1998 and Trent Bridge in 2006.
England resumed Tuesday on 57 for five, having collapsed in the face of paceman Dhammika Prasad's dramatic burst of four wickets for 15 runs on Monday.
It was all a far cry from when England were 311 for three after tea on the second day of this Test, thanks to Australia-born opener Sam Robson's maiden Test century, and even when they reduced Sri Lanka to 277 for seven on Monday - a lead of just 169.
But Sri Lanka captain Angelo Mathews, the man-of-the-match, responded with a superb Test-best 160 and a key eighth-wicket stand of 149 with Herath, who made a valuable 48.
Mathews's hundred, his second of the series, followed his Test-bowling return of four for 44 earlier in this match.
There were more than 20 overs remaining when England No 11 James Anderson came into bat.