But in the 2nd match, India beat Bangladesh by 6 wickets.
Perera was the top-scorer with 74 off 48 balls, his innings studded with eight fours and two sixes, while Mendis' 30-ball 57 featured two fours and five sixes. They lost 13 of their last 14 T20Is and will need to find ways to get back to their form.
Rahim, who hit five fours and four sixes, broke into a dance after giving Bangladesh their highest-ever run chase in the shortest format, and the fourth biggest overall in worldwide T20s.
Bangladesh's victory was orchestrated by openers Tamim Iqbal and Liton Das who raced to 74 for 1 at the end of the power-play overs before Mushfiqur Rahim unleashed fury with brilliant stroke play, leading the tourists to a record run chase with two balls to spare.
Earlier, half-centuries from opener Kusal Mendis and Kusal Perera powered Sri Lanka to 214 for six against Bangladesh in the third Twenty20 worldwide of the Nidahas tri-series in Colombo on Saturday.
GETTYSri Lanka beat India in the first game of the T20 series
Mahmudullah chose to bowl first against Sri Lanka. Sri Lanka piled up 70 runs off the first six overs, including 22 runs off Taksin Ahmed's second over, but could not continue the momentum in the middle overs.
In the first match of the tournament, this Sri Lanka defeated India by 5 wickets. Tamim and Liton gave us a good start.
In reply Bangladesh started well with Tamim Iqbal (47) and Liton Das (43) getting them off to a ideal start.
Dasun Shanaka and Dinesh Chandimal fell cheaply but Upul Tharanga helped Sri Lanka score 17 runs in the 17th over with the help of two boundaries and a six. Bangladesh paceman Mustafizur Rahman claimed three wickets. Despite Gunathilaka (26) falling to Mustafizur Rahman, Perera and Mendis tore into the bowling.
Mendis and Danushka Gunathilaka had given Sri Lanka a blazing start with the fifty coming in the fourth over.
Cricket South Africa apologies for Sonny Bill Williams masks
That incident is behind a fiery exchange between Warner and South Africa's Quentin de Kock during the First Test. Security complied - only for Eksteen and Kazi to overrule them after fans complained.