Sri Lanka captain Angelo Mathews scored his second hundred in as many Tests as the tourists got on top of England in the second Test at Headingley on Monday.
Sri Lanka in their second innings were 426 for eight -- the highest total of the match -- at tea on the fourth day, a lead of 318 runs.
Mathews was 149 not out, having made 102 in the drawn first Test of this two-match series at Lord's.
More From This Section
The pair were only separated on the stroke of tea when Mathews set off for a single in search of 150, stopped and sent non-striker Herath back only for the left-arm spinner to be run out by Joe Root's direct hit from mid-on.
Mathews, who took a Test-best four for 44 in England's first innings 365, gave just the one chance when fast bowler Liam Plunkett failed to hold a hard return catch when the all-rounder was on 87.
Sri Lanka resumed Monday on 214 for four, a lead of 106, with star batsman Mahela Jayawardene 55 not out and Mathews 24 not out.
The pair, against less than attacking fields, cashed in by scoring 40 runs in seven overs before England took the new ball.
Jayawardene had moved on to 79 when Ian Bell dropped a low chance in the gully off Stuart Broad.
But the 37-year-old, in probably his last Test innings in England, hadn't added to his score when he drove loosely at James Anderson, the bottom hand coming off the bat handle, and was caught by wicketkeeper Matt Prior.
Sri Lanka were now 268 for five.
But that soon became 277 for seven as Plunkett, who'd taken a Test-best five for 64 on his home ground in the first innings, struck twice in two balls.
Dinesh Chandimal pulled Plunkett straight to Gary Ballance at deep square leg and next ball Dhammika Prasad, trying to steer over the slips, was well caught by Joe Root, running in from short third man.
An angry Mathews threw his bat down in frustration with Chandimal, before surviving the hat-trick ball after the umpires ruled the batsmen had crossed.