Sri Lanka 336 and 226 for 7 (Dickwella 27*) need a further 75 runs to beat England 290 and 346 (Root 123, Foakes 65*, Burns 59, Dananjaya 6-115)
Live scorecard and ball-by-ball details
At tea, this was shaping to be a classic. Sri Lanka needed 82 to win, with five wickets in hand, and Angelo Mathews was batting like the colossus he used to be several years ago. But in the 20 deliveries bowled after tea, England took two monumental strides, and the game's outlook was transformed.
The first blow after the break was struck by Moeen Ali, who had bowled beautifully just before the break as well. Third ball, he trapped Mathews in front of the stumps for 88 - the second occasion in the series in which Mathews has been out in the over after tea. The next wicket went to Jack Leach, who looped one into Dilruwan Perera's boot and raised a successful lbw appeal, the batsman having just plain missed it.
When the rains came to wash out the remainder of the day's play, Sri Lanka had Niroshan Dickwella at the crease on 27, but only had Akila Dananjaya, Suranga Lakmal and Malinda Pushpakumara to come. A difficult 75 runs were still needed.
The pitch? A tough one. The occasional ball still took off from a length for the spinners, but it seemed to have slowed down quite a bit, meaning that batting was still difficult, but perhaps not as arduous as it had been on days two and three. Dananjaya and Lakmal were involved in partnerships worth 56 and 28 in the first innings, but on this occasion, they will be batting with a less secure senior batsman in Dickwella, and also have to contend with the intense pressure of a run chase.
England had taken three wickets in the first session, to seize the initiative, and resumed after lunch with another piece of fielding magic - the likes of which has kept them in the game more than once. Dimuth Karunaratne was batting well - even better than Mathews at that stage - but when on 57, he went for a lap sweep off Adil Rashid. He could barely believe how he had been dismissed after playing that shot so well.
Keaton Jennings, fielding at short leg, began to move, anticipating the shot and snatched at the ball, which had come off the bat at some speed. He didn't quite snaffle it himself, but parried it to wicketkeeper Ben Foakes, who was in the perfect position to complete the catch. Sri Lanka's two senior-most batsmen had been parted. With 198 left to get, the hosts were four wickets down.
Mathews, though, stepped up through the middle of the second session, making fuss-free runs into the well-spread outfield, while Roshen Silva worked himself slowly into the innings, as he had done in the first dig. As for every other batsman who has spent any time at the crease in this Test, there were edges that dropped short, and plenty that spun past the bat; lbw appeals as well. Mathews got his reverse-sweep in good working order, which was important against the finger spin of Leach and Moeen especially. Against Rashid, who had a tendency to pitch short, he sat back and cut him to the cover sweeper. There were a couple of occasions on which Rashid's googly was not read by the Sri Lanka batsmen, but they eventually began to pick it.
Roshen, though, departed before he and Mathews could truly make the game secure, caught at slip off Moeen, to end their 73-run stand. Mathews would only add 20 further runs to his own score before himself being dismissed. His stand with Dickwella was worth 45, with the wicketkeeper-batsman playing a typically high-risk brand of cricket through that period, sweeping and reverse-sweeping with abandon, and almost getting caught when he miscued an attempted lofted cover drive.
In the first session, Leach had struck three times in successive overs to dismiss Kaushal Silva, Dhananjaya de Silva and Kusal Mendis for single figures, leaving Sri Lanka gasping at 26 for 3. The wicket of de Silva was again thanks largely to the excellent work of Jennings at short leg, who was wrong footed, but managed to stick out his left arm and snatch the low chance after de Silva had looked to work the ball to leg. Karunaratne and Mathews then instilled a bit of calm into the chase with their 77-run stand, but again did not bat long enough together to put Sri Lanka into a comfortable position.
Before that, England's last-wicket pair, Foakes and James Anderson had added 22 to the overnight score. Anderson was bowled by Dilruwan Perera immediately after Sri Lanka took the second new ball, leaving Sri Lanka a target of 301 to win.