Last man James Anderson's 55-ball vigil without scoring ended when he fended off the second last ball of the match, a nasty short-pitched delivery from Shaminda Eranga, to be caught in the close cordon by Rangana Herath, leaving the dogged Moeen Ali unbeaten with a gallant century (108, 17 fours).
Playing in only his second Test, Moeen spent some six hours consuming 281 balls and in hindsight his calculated risk to allow Anderson to play out the final over proved catastrophic for England.
It was clear when England resumed their second innings at 57 for five on the fifth and final day Tuesday that the 350-run victory target was beyond their reach.
England sensibly tried to bat out the day and their last three wickets almost seen it through, but for that one folly of Anderson. They were also helped to an extent by the fickle Yorkshire weather when rain forced an early lunch. Later in the afternoon, fading light forced Sri Lankans to use the spin of Mahela Jayawardene.
Dhammika Prasad starred with the ball for the victorious visitors, adding Matt Prior's wicket to his fourth day's four wickets.
It was Moeen all the way, for a free-stroking batsman batted on and on not even trying to get to his hundred when Nos. 10 and 11 joined him. England had three wickets to play out the last session and they nearly drew the match.
Where Sri Lanka succeeded in a similar situation in the first Test, England failed, but narrowly.
Skipper Agelo Mathews was named the Man of the Match for his match-winning 160 in the second innings and four wickets in England's first innings.