But Silva built crucial partnerships including a 56-run ninth wicket stand with Akila Dananjaya as the hosts edged past England's total. Karunaratne and Dhananjaya de Silva (59) added 96 runs for the third wicket when De Silva pushed one to the covers and took on England's best fielder.
Leach came in as night-watchman with one over left to negotiate, which he safely did, playing out a maiden to see England through to the close.
Root was punished after he "appeared to show dissent" by shaking his head and kicking the ground in the 76th over of Sri Lanka's innings after umpire Marais Erasmus adjudged Dilruwan Perera was not out to a delivery from Moeen Ali.
The hosts, down 1-0 in the three-match series, were bowled out for 336 in reply to England's 290.
"We're very much feeling good about the fact that we're bowling last on that wicket. We feel if we can put pressure on them with our batting, get a good total, then we can win".
Root's struggle against left-arm spin, meanwhile, compounded England's crisis after the captain, dismissed twice by Rangana Herath in his farewell test in Galle, fell for 14 to Malinda Pushpakumara, who squeezed one through the batsman's defence.
"Getting a lead of 46 is a big advantage to us against their spinners when it comes to the fourth innings", Karunaratne said. However, the lead is important ahead of an intriguing couple of days.
Having gone to tea two shy of three figures, Root took centre stage again in the first over after the restart, reaching his second hundred in Asia with a thick edge for four down to third man in a rare over of seam bowling from Suranga Lakmal. We need to look at our strategy and if we can keep them down to 250 in the second innings, we can chase down the target.
Sri Lanka hit back to reduce England to 109-4 but Root, Buttler (34) and Foakes built an imposing target in Pallekele, despite the pitch perhaps not being as hard to bat on as first thought.
"Rooty (captain Joe Root) has been massive in the dressing room saying "don't worry about making mistakes" and we're just trying to go out with a positive mindset".