Kumar Sangakkara again relished Bangladesh's bowling attack as he cracked his third successive century against them to pull Sri Lanka out of trouble in the second and final cricket test in Colombo.
Dinesh Chandimal (102) scored 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.
The 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.
Chandimal put on 195 for the fifth wicket with Sangakkara before being bowled by paceman Rubel Hossain.
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.