The hard-fought win clinched the three-match series for England as they earned an unassailable 2-0 lead.
In a match where fortunes swung wildly from one side to another, it was the tourists who fared better at the crucial moments to record a famous win.
Here, we rate the performances of both sets of players after what has been an enthralling Test battle.
Dimuth Karunaratne – 8/10
The Sri Lankan opener performed his job as well as he could have done by notching up half-centuries in both the innings. Will be miffed that he failed to convert either one of them into a ton.
Kaushal Silva – 3/10
Not the best of returns to the Test side for the Sri Lankan opener who could muster only 10 runs from his two innings at Pallekele.
Dhananjaya de Silva – 6/10
The all-rounder registered a crucial 59 in the first innings but could add just one more to his tally in the second. He bowled a total of just six overs with his off-break.
Kusal Mendis – 2/10
A Test match to forget for the talented right-hander. The top-order batsman was dismissed for one run in both his innings.
Angelo Mathews – 7/10
The former Sri Lanka skipper once again showed his class with his third half-century in four innings. His battling 88 under the most difficult of circumstances in the second innings gave the islanders some hope of pulling of a dramatic win.
Roshen Silva – 7/10
The lower-order batsman carved a fine 85 to help Sri Lanka take a vital first-innings lead and was looking good in the second innings too before falling to Moeen Ali.
Niroshan Dickwella – 6/10
The wicketkeeper-batsman chipped in with some handy contributions with the bat in both innings with his early dismissal on Sunday extinguishing all Sri Lanka hopes of a win.
Dilruwan Perera – 7/10
The senior Sri Lanka spinner picked up a seven-wicket haul across the two innings and cannot be faulted for his efforts. However, he and the remaining Sri Lanka spinners were upstaged by their England counterparts.
Akila Dananjaya – 7/10
The youngster came into the match under the cloud of a suspect bowling action and picked up eight wickets including a career-best 6-115 in the second innings. He was, however, highly expensive.
Malinda Pushpakumara – 6/10
Three wickets in the first innings for the left-arm orthodox spinner but he could pick up just the one in his second go and was the weakest of Sri Lanka’s three-man spin contingent.
Suranga Lakmal – 7/10
On a wicket where spinners picked up 38 of the 40 wickets to fall, Lakmal was the only seamer to pick up one. Did as well as he could do on a surface not ideal for the pacers.
Rory Burns – 7/10
After a disappointing debut Test, Burns showed his class with a crucial 43 in the first innings. He brought up a maiden Test half-century in the second and showed he can be a long-term successor to Alastair Cook.
Keaton Jennings – 5/10
Jennings’ most important contributions in the Test came through his sensational bits of fielding at short-leg in the second innings.
Ben Stokes – 4/10
The England all-rounder was promoted to No3 in the batting order in the first innings but disappointed with a score of just 19. Was dismissed for a duck in the second innings. Stunning runout of Karunaratne in the first innings was a momentum shifter.
Joe Root – 9/10
The England skipper would have been disappointed to score just 14 in the first innings but he more than made up for it with a match-winning counter-attacking ton in the second.
Jos Buttler – 7/10
The England middle-order batsman continues to prove his worth to the Test squad with two more handy contributions lower down the order. His combined 98-run tally was crucial in England’s win.
Moeen Ali – 8/10
The England all-rounder was excellent with the ball, especially in the second innings where he picked up four wickets. Will however be disappointed to be dismissed on 10 with the bat in both innings.
Ben Foakes – 7/10
The Surrey wicketkeeper-batsman continued to impress in his second Test outing with a highly valuable unbeaten 65-run knock in the second innings that helped England set Sri Lanka a daunting chase.
Sam Curran – 7/10
His left-arm pace barely created any impact in the match but the youngster’s 64-run knock batting with the tail in the first innings might be the biggest turning point.
Adil Rashid – 7/10
Four wickets and a handy 31-run knock in the first innings from Adil Rashid whose contributions waned as the match progressed.
Jack Leach – 9/10
The left-armer was perhaps the best spinner on display from either side which speaks volumes about his performance. A maiden five-for in Test cricket in the second innings is just reward for his perseverance.
James Anderson – 5/10
A rare wicketless outing for the England veteran seamer but it was just not the type of surface for him to thrive on.
Know more about Sport360 Application
The tourists, whose previous win on these shores came in 2001, needed just half-an-hour on day five to dismiss Sri Lanka for 243 – taking the last three wickets for 17 runs.
Moeen Ali claimed the key scalp of Niroshan Dickwella for 35, then clean bowled Suranga Lakmal for duck before Jack Leach ended things with a caught and bowled to see off last man Malinda Pushpakumara and bag his maiden five-wicket haul.
England take a 2-0 lead into the final match in Colombo, eyeing a historic clean sweep.
Beating Sri Lanka is not quite the scalp it was in the days of Muttiah Muralitharan, Kumar Sangakkara and Mahela Jayawardene but this still represents a considerable achievement given they have lost only one of the previous six series on home soil and recently thrashed South Africa.
It also represents England’s first away triumph since they defeated the Proteas in 2015/16, and a first with Joe Root at the helm.
Root’s side had arrived at Pallekele Stadium as favourites to finish the job, with two late wickets on day four swinging the momentum sharply in their direction after Angelo Mathews’ fightback.
Home hopes laid squarely with Dickwella, a talented ball-striker more suited to a blaze of glory than a meticulous chase.
He played against type as he and Akila Dananjaya knuckled down for almost five overs, working singles to chalk off 14 from their target.
There was nothing to alarm England beyond the batsmen’s steady mindset and enough turn for both their left and right-arm finger spinners to work with.
Had they had to wait much longer, the tension would surely have begun ratcheting up, but Moeen hit the jackpot with the first ball of his third over.
He tossed one up to tempt Dickwella and ripped it just enough to take the edge and sail safely to Ben Stokes at slip.
Dickwella pivoted angrily on his heel and gestured towards the stumps with his bat, knowing he had left too much for the tail to do.
Moeen wasted no time in besting Lakmal, a big lbw appeal first up and then pegging back off stump as the next ball straightened from around the wicket.
He finished with four for 72, with left-armer Leach drawing things to a close by pouching the simplest of return catches from Pushpakumara.
That saw him close on five for 83 and also ensured a record 38 of the 40 wickets to fall in the match had been taken by spinners.
Lakmal’s dismissal of Keaton Jennings on the first morning was the seamer’s only scalp, with Stokes chiming in with a first-innings run out.
According to data analysts CricViz, the last time no English seamer took a wicket in a match was in Karachi in 1973.
Moeen Ali bagged the big wicket of Niroshan Dickwella early on day five to give England the perfect start. The England all-rounder picked up two wickets in three deliveries as he also sent back Suranga Lakmal for a duck.
Jack Leach then dismissed Malinda Pushpakumara to complete a 57-run win for England who take an unassailable 2-0 lead in the three-match series.
The hosts resumed from their overnight score of 226-7 in the second innings, still 75 runs away from what would be a famous victory.
Do not miss any of the action from this enthralling Test at the Pallekele International Stadium by following the ball-by-ball coverage below.