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.
Importantly, he received superb support from Rangana Herath (48) in an eighth-wicket stand of 149.
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.
Mathews then drove Plunkett for a ferocious six over mid-wicket and smashed Anderson down the ground for four.
He was 13 runs shy of a hundred when he smacked a drive back at Plunkett, who dropped an awkward caught and bowled chance.
Mathews, either side of his reprieve, twice forced Plunkett behind point for four, the second boundary taking him to 99.
A single off Broad saw Mathews to his hundred in three-and-a-half hours off 153 balls with 14 fours and a six.
It was just the 27-year-old's fourth century in 40 Tests but third since he became captain last year.
England had seemed more concerned trying to get Herath on strike than dismissing Mathews, with captain Alastair Cook rarely putting pressure on his Sri Lankan counterpart with attacking fields
Off-spinner Moeen Ali, given one over before the new ball despite taking two wickets for no runs in three balls Sunday, was eventually brought back into the attack.
Herath, on 21, swept Ali into the flap of his pad and a diving Prior just failed to cling on to the right-handed chance.
Herath pulled Broad for four to bring up a hundred partnership with Mathews and then cover-drove the paceman to the boundary before he was run out.
He faced 82 balls with nine fours in nearly three hours at the crease.