Mathews made 80 as Sri Lanka, again forced to follow-on, stopped England strolling to a series-clinching win.
At the close of the third day, Sri Lanka were 309 for five — still 88 runs behind England’s first innings 498 for nine declared, which featuredMoeen Ali’s Test-best 155 not out.
Mathews’s fourth-wicket second-innings stand of 82 — Sri Lanka’s first fifty partnership of the series — with opener Kaushal Silva (60) kept England at bay for much of Sunday’s play.
Dinesh Chandimal (54 not out) and Milinda Siriwardana (35 not out) built on that platform with an unbroken partnership of 87 that took Sri Lanka to stumps.
Sri Lanka had at least stopped the rot after becoming the first side since New Zealand in England back in 1958 to be bowled out for under 120 in three successive Test innings following their 101 first time around in this match.
Mathews’s men totalled just 91 and 119 during a crushing innings and 88-run defeat in the first of a three-Test series at Headingley last week.
But Sunday’s second-innings effort — something badly needed for their own morale and that of all those who want to see competitive Test cricket — kept them in this match.
It also left open the possibility of a stunning, come-from-behind, win if they could set England 100 or more for victory.
“We have to bat positively tomorrow,” Silva told Sky Sports. “We have to get those 80 runs and then set a target.”
Sri Lanka’s second innings saw the talented Kusal Mendis make a brisk 26 before he was caught behind off a James Anderson delivery that nipped away.
Lahiru Thirimanne scored 13 before off-spinner Ali bowled him with a classic delivery that turned past the left-hander’s outside edge as he pushed forward.
Silva’s leg-glance off fast bowler Steven Finn, his sixth boundary, saw him to a 111-ball fifty.
– Finn strikes –
Mathews then clipped Stuart Broad through mid-wicket for four and cut him to the point rope, before his slogged six off Ali brought up Sri Lanka’s 150.
Ali beat the advancing Mathews, then on 36, only for wicket-keeper Jonny Bairstow to miss the stumping chance.
Mathews went on to complete a 63-ball fifty, featuring 30 runs in boundaries.
Finn broke an entertaining stand, however, when his bouncer surprised Silva, whose skyed pull into Bairstow’s gloves ended nearly four hours of resistance.
The umpires checked for a possible no-ball, but Finn had narrowly avoided over-stepping and Sri Lanka were 182 for four.
“It’s just about trying to find more consistency,” said Finn, who ended the day with figures of one for 55 from 16 overs.
“(The side strain) is not in my mind, my body is fine, I’m just trying to get in a battle and take wickets for England.”
Mathews made his Test-best score of 160 against England in a series-clinching win at Headingley in 2014.
But he fell short of a hundred on Sunday when Anderson, as he’s done so often in becoming England’s all-time leading Test wicket-taker, produced a fine leg-cutter that squared Mathews up and took the outside edge, with Bairstow holding a tumbling catch.
Sri Lanka were now 222 for five, with more than 19 overs left before stumps.
But with the ground now bathed in sunshine, conditions for batting had improved greatly.
England had four overs with the new ball prior to the close, but Chandimal responded by cover-driving Broad for his fifth four to complete a 95-ball fifty.