Overnight batsman Ben Foakes made an unbeaten 65 before England were bowled out for 346 to set Sri Lanka a winning target of 301 in the second Test on Saturday.
Dilruwan Perera (3-96) bowled James Anderson for 12 to bring an end to England’s second innings in the morning session on day four in Kandy after the visitors had resumed on 324-9.
Akila Dananjaya, whose action is under investigation by the International Cricket Council, finished with career-best figures of 6-115 in just his fifth Test.
Foakes, who followed up his debut ton in Galle with another gritty knock, added 14 to his overnight 51 and shared 41 runs for the last wicket with Anderson.
Skipper Joe Root’s 124 remained the highlight for England who overcame their 46-run deficit and took the attack to the opposition spinners on Friday.
England lead the three-match series 1-0.