Perera smashed an unbeaten 80 off 57 balls to lift the tourists from a hopeless 67-8 in the 22nd over to 180 all out after Bangladesh won the toss and elected to field.
Sensing an opening, Sri Lanka hit back to bowl out the hosts for 167 in the 40th over of the rain-curtailed match at the Sher-e-Bangla stadium.
Bangladesh, riding on opener Shamsur Rahman's 62 off 49 balls and 44 from Mominul Haque, were cruising at 114-2 in the 20th over when the batting came apart.
Perera proved to be Sri Lanka's hero after the tourists were left in tatters in a match reduced to 43-overs-a side from the stipulated 50 due to bad weather.
Also Read
Perera and Senanayake ensured Sri Lanka did not fall below 147, their lowest one-day total against Bangladesh, by adding 82 runs for the ninth wicket.
Perera, who helped Sri Lanka record last-ball wins over Bangladesh in two Twenty20 matches last week, hit six sixes and four boundaries in a superb rearguard action.
Bangladesh lost Anamul Haque off the second ball of the innings, caught in the slips off Lasith Malinga, but Shamsur and Mominul put on 79 for the second wicket.