Mendis top-scored with 54 while Perera added 52 off 40 balls for the home after they were sent to bat first by Bangladesh captain Mashrafe Mortaza at Sinhalese Sports Club ground.
Bangladesh did a commendable job in the field to restrict the home side within a gettable score after initial hammering by openers Danushka Gunathilaka and Upul Thranga.
Needing a win to avoid a series defeat for the first time against Bangladesh, Gunathilaka and Tharanga began aggressively to put on 76 runs in their opening stand in a little over 10 overs.
Taskin Ahmed beat Tharanga with pace to bowl the Sri Lanka captain out for 35 runs, putting a brake finally on their run-rate.
More From This Section
Mendis, who scored a century in the abandoned second match, tried to rebuild the innings and former captain Dinesh Chandimal, but two successive run outs hurt them again.
Chandimal was ruled run out for 21 as he ambled into the crease only for reply to show both his feet and bat in the air when Mushfiqur Rahim collected a Taskin throw from deep point to break the stump.
With Bangladesh making regular breakthroughs, Perera launched a counter attack to race to his second half-century in the series before he fell to Mortaza in the final overs.
Mortaza finished with 3-65 while Mustafizur Rahman picked up 2-55 for Bangladesh, who are leading the three-match series 1-0.
Bangladesh won the first match by 90 runs before the second match was washed out by rain.