Playing in his seventh Test, Mendis was unbeaten on 169 after substantial partnerships with Dinesh Chandimal and then Dhananjay de Silva as Sri Lanka reached 282-6 in their second innings when rain set in.
While the first two days of a rain-affected match were dominated by the bowlers, Mendis managed to tame what had appeared to be a hostile track in a superb innings.
Starting the day on 6 for 1, still 80 runs behind the Australians, the hosts were soon in even deeper trouble when Dimuth Karunaratne was judged lbw against Mitchell Starc without adding to the overnight score.