Kumar Sangakkara again relished Bangladesh's attack as he cracked his third successive century against them to pull Sri Lanka out of trouble in the second and final Test on Sunday.
Dinesh Chandimal (102) also made merry, scoring his second consecutive Test hundred against the tourists as Sri Lanka recovered from 69-4 to reach 294-6 in their first innings at stumps on the second day in reply to Bangladesh's 240.
Left-hander Sangakkara (127 not out), who made a century in each innings of the drawn first Test in Galle, reached the 33rd hundred of his career when he straight-drove off-spinner Sohag Gazi for two in the final session.
It was the second time that Sangakkara had made three successive Test tons, the previous occasion being against India in 2009-10. He also completed 6,000 Test runs at home during his solid 271-ball knock, which contained 10 fours.
Chandimal, who made an unbeaten 116 in the last match, reached his century with three runs off spinner Mohammad Mahmudullah. He put on 195 for the fifth wicket with Sangakkara before being bowled by paceman Rubel Hossain.
He hit eight fours, including three in an over from Gazi, in his impressive 176-ball knock.
Rubel got another wicket with the second new ball when he had Kithuruwan Vithanage (12) caught by Mominul Haque at deep point.
Bangladesh, who struck three times in the morning session in the space of 30 runs to put Sri Lanka under pressure, got just two more wickets in the last two sessions as Sangakkara and Chandimal applied themselves effectively.
The hosts had added 276 runs to their overnight total of 18-1 by the end of the day.
Bangladesh dominated the first session as Abul Hasan, Robiul Islam and Gazi each took one wicket.
Dimuth Karunaratne added five to his overnight score of 12 before he was caught by wicket-keeper Mushfiqur Rahim off Abul. Lahiru Thirimanne was also caught behind, off paceman Robiul.
Thirimanne, who scored a century in the last match, failed to open his account this time.
Gazi put more pressure on Sri Lanka when he had skipper Angelo Mathews (16) caught by Mahmudullah in the slips.