Kumar Sangakkara continued his purple patch against Bangladesh and hit an unbeaten 127 to guide Sri Lanka to 294 for six at close on the second day of the second and final Test on Sunday.
Sangakkara hit his third consecutive century in the series and with Dinesh Chandimal (102) helped the hosts overcame a top-order collapse and take a 54-run lead at the close of play.
The left-handed batsman, who became the fifth Sri Lankan to hit centuries in both innings of a Test match in the drawn Galle Test last week, shared a 195-run stand with Chandimal to bail out the hosts after a wobbly morning session.
Rubel Hossain bowled Chandimal to put an end to the partnership, which helped Sri Lanka go past Bangladesh's first innings total of 240. He also dismissed Kithuruwan Vithanage (12), caught by Mominul Haque at deep cover.
Bangladesh were on top in the first session of the day after taking three quick wickets and Sri Lanka were reeling at 69 for four at one stage before Sangakkara and Chandimal fought back.
Sangakkara, who also hit three centuries in as many innings against India in 2009-10, drove off-spinner Sohag Gazi straight down the ground to complete his 33rd Test century.
Resuming the second day's play on 18 for one, Sri Lanka lost opener Dimuth Karunaratne (17) when Abul Hasan beat him with extra pace to induce an edge behind the stumps.
Robiul Islam then dismissed Lahiru Thirimanne for a duck as the batsman went for a drive but ended up giving wicketkeeper Mushfiqur Rahim his third catch of the innings.
Sri Lanka's trouble compounded when skipper Angelo Mathews (16) was caught in the slip trying to play a defensive shot to a Gazi delivery.
Scoreboard at the close (Day 2)
Bangladesh first innings: 240
Sri Lanka first innings (overnight 18-1)
D Karunaratne c Rahim b Hasan 17
T Dilshan c Rahim b Robiul 0
K Sangakkara not out 127
L Thirimanne c Rahim b Robiul 0
A Mathews c Mahmudullah b Gazi 16
D Chandimal b Rubel 102
K Vithanage c Mominul b Rubel 12
N Kulasekara not out 2
Extras: (b-2 w-6 nb 10) 18
Total 294 for 6 (93 overs)
Fall of wickets: 1-7, 2-39, 3-43, 4-69, 5-264, 6-280
Bowling: Robiul 15-1-52-2(nb-7), Sohag Gazi 30-4-84-1, Hasan 18-4-62-1 (w-1), Rubel 14-3-41-2 (w-1 nb-3), Mahmudullah 10-1-36-0, Mominul Haque 2-0-6-0, Ashraful 2-0-9-0, Nasir 2-0-2-0.