Dilruwan Perera was on five with Sri Lanka leading by 196 runs with four wickets in hand as rain continued to plague the test which has already seen the final sessions of the first two days washed out.
Resuming on six for one, Sri Lanka lost Dimuth Karunaratne to Mitchell Starc in the third delivery of the day.
Steve O'Keefe dismissed Kaushal Silva and his spin partner Nathan Lyon sent back home captain Angelo Mathews (nine) to reduce Sri Lanka to 86-4.
Mendis then forged two important partnerships to rebuild the Sri Lankan innings, raising 117 runs -- comfortably the highest of the match so far -- with Dinesh Chandimal (42) and 71 with Dhananjaya de Silva (36) to haul his team back into the contest.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
In a match where no other batsman has managed a fifty, Mendis brought up his maiden hundred in style, slog-sweeping Lyon over midwicket for six.
Lyon dismissed de Silva for his 200th test wicket but Mendis was unfazed at the other end, sweeping the spinners and cutting the pacemen with equal ease.
With Mendis on song, Sri Lanka completely dominated the post-lunch session, adding 137 runs at a four-plus run rate for the loss of Chandimal's wicket.
Mendis hit 20 boundaries, including a couple of glorious cover drives, in his 243-ball masterclass and had contributed nearly 60 percent of the team score in the second innings.
The visitors' woes were compounded when spinner O'Keefe hobbled off the ground, Cricket Australia later confirming in a tweet that he has a "right hamstring issue".
(The story was refiled to correct O'Keefe to Lyon in paragraph 7)
(Reporting by Amlan Chakraborty in New Delhi; editing by Sudipto Ganguly, Neville Dalton)
