Tillakaratne Dilshan's 17th one-day century proved in vain on Thursday as Bangladesh beat Sri Lanka by three wickets under the Duckworth/Lewis rain rule to win the third and final one-day international and share the series one-all.
Sri Lanka looked to be in control when they ran up an impressive 302 for nine after choosing to bat first.
But Bangladesh whose run chase was interrupted in the 14th over when they were 78-1, were then set a revised target of 183 to win off 27 overs.
They were given a splendid start by Anamul Haque (40) and Mohammad Ashraful (29) who posted 77 at a run-a-ball.
Earlier man-of-the-match and man-of-the-series Dilshan with 125 off 128 balls, including 12 fours, and Kusal Perera provided Sri Lanka with a fine launchpad, putting together an opening stand of 116 off 127 balls.
Perera's contribution in the partnership was 56, his maiden one-day half-century.
Kumar Sangakkara helped Dilshan add a further 87 for the second wicket by scoring 48. During his knock Sangakkara became the first Sri Lankan and seventh batsman overall to pass 11,000 runs in one-day international cricket.
There was also a milestone for Bangladesh left-arm spinner Abdur Razzak who ran through the Sri Lanka middle order to take five for 62 and become the first bowler from his country to take 200 one-day wickets.
Bangladesh complete their five-week tour of Sri Lanka on Sunday when they take on the hosts in a one-off Twenty20 international at the same venue.
Scorecard
Sri Lanka:
K. Perera c Nasir b Mahmudullah 56
T. Dilshan c Nasir b Shahadat 125
K. Sangakkara c Anamul b Razzak 48
T. Perera b Razzak 4
A. Mathews st Mushfiqur b Razzak 6
J. Mendis b Gazi 5
D. Chandimal b Ziaur 0
L. Thirimanne not out 25
N. Kulasekara lbw b Razzak 11
S. Senanayake b Razzak 0
S. Malinga not out 5
Extras: (lb-2 nb-1 w-14) 17
Total: (for nine wickets, 50 overs) 302
Fall of wickets: 1-116, 2-203, 3-212, 4-228, 5-233, 6-238, 7-263, 8-291, 9-291.
Bowling: Shahadat 10-0-71-1 (3w 1nb), Ziaur 10-0-65-1 (1w), Gazi 10-1-52-1 (3w), Razzak 10-0-62-5 (7w), Mahmudullah 10-0-50-1.
Bangladesh:
Anamul Haque c Chandimal b Mathews 40
Mohammad Ashraful lbw b Senanayake 29
Jaharul Islam c Sangakkara b Mathews 26
Mushfiqur Rahim run out 9
Nasir Hossain not out 33
Mahmudullah lbw b Senanayake 6
Mominul Haque c Sangakkara b Malinga 11
Ziaur Rahman c T Perera b Malinga 0
Sohag Gazi not out 4
Extras: (b-4 lb-13 w-9) 26
Total: (for seven wickets, 26 overs) 184
Fall of wickets: 1-77, 2-97, 3-119, 4-126, 5-144, 6-166, 7-166.
Did not bat: Shahadat Hossain, Abdur Razzak.
Bowling: Kulasekara 4-1-29-0 (5w), Malinga 6-0-29-2 (2w), Mathews 5-0-39-2, Senanayake 6-0-26-2 (1w), T. Perera 5-0-44-0
(1w).
Result: Bangladesh won on Duckworth/Lewis system.
Series drawn 1-1 with one no-result.
Sri Lanka beat Bangladesh by seven wickets to win series
Jayalalithaa accuses DMK chief of doublespeak
Herath bags two late wickets to boost Sri Lanka
Sri Lanka players withdrawn from Chennai IPL matches
Sri Lanka's Herath puts Bangladesh in a spin