Australia, who need to bat out the remainder of the match to win the series 1-0, were 16 for 0 in their second knock at the break with Shane Watson on seven and Phil Hughes on four.
Fast bowler Peter Siddle claimed two of the last four Sri Lankan wickets to finish with 4 for 91 from 35 overs. Trent Copeland and Mitchell Johnson picked up two wickets each.
Siddle bowled Shaminda Eranga for 12 and trapped Rangana Herath leg-before for three within the first hour.
Mathews was stranded on 95 when Sri Lanka lost their ninth wicket, but the right-hander reached the coveted century by driving Siddle to the cover fence for his 10th boundary.
The 24-year-old has been one of Sri Lanka's few batting stars in the series, having made 95 in the first Test in Galle and 58 in the drawn second game in Pallekele.
Last man Suranga Lakmal contributed 13 in a 10th-wicket stand of 23 with Mathews before he was bowled by Johnson.
Australia, playing their first Test series in Sri Lanka since 2004, won the first match by 125 runs.