At close, Niroshan Dickwella was unbeaten on 14 with Mendis.
The hosts got off to a false start when paceman Subashis Roy bowled out opener Upul Tharanga for four, bringing the 22-year-old Mendis to the crease.
Bangladesh also managed to dismiss Dimuth Karunaratne (30) and Dinesh Chandimal (five) to reduce Sri Lanka to 92 for three.
That brought Mendis and Gunaratne together and the duo put the Bangladesh bowling to the sword.
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.
The touring side had their only other success of the day when paceman Taskin Ahmed bowled out the 31-year-old Gunaratne after Bangladesh had taken the second new ball in the 81st over.
It was the second test hundred for Mendis, who hit 18 fours and two sixes in his 242-ball knock.
(Writing by Sudipto Ganguly in Mumbai,; editing by Larry King)
