Mendis followed up his maiden century in the first Test with a top score of 86 in Galle as Sri Lanka posted a total of 281 in their first innings before then grabbing two early wickets during the tourists' response.
Australia were 54 for two at stumps, still trailing the hosts by 227 runs in what is a must-win match for Steve Smith's side after they lost the first Test last weekend in Pallekele.
The debutant Vishwa Fernando also celebrated his first wicket in Test cricket when he sent opener Joe Burns trudging back to the pavilion for nought in only the second ball of the innings.
Usman Kawaja was the not-out batsman and he will resume his innings on Friday on 11.
Also Read
But he became Starc's 100th victim in Test wicket when he was caught by the wicketkeeper Peter Nevil with the score at 184-4.
Having already accounted for the two Sri Lankan openers, the same bowler then accounted for the tailenders Rangana Herath and Lakshan Sandakan to finish with figures of 5 for 44.
Despite Starc's heroics, Sri Lanka enjoyed the better of the day with Mathews hitting an entertaining 54 off 65 balls which included three sixes.
Sri Lanka won the first Test at Pallekele by 106 runs, the first triumph in a Test match over the number one-ranked Australians in 17 years.
A victory for Sri Lanka in Galle would see them secure the series with one match to spare.