Rahim was caught leg-before to Kulasekara two balls later, but his 200 helped Bangladesh reach 550-6 in their first innings in reply to Sri Lanka's 570-4 declared.
He hit 22 boundaries and a six in the course of his 321-ball innings.
Former captain Mohammad Ashraful fell for 190 in the morning session after adding a record 267 for the fifth wicket with Rahim, the highest stand by Bangladesh for any wicket in Tests.
Rahim, who made his Test debut aged 16 against England at Lord's in 2005, has so far scored 1,787 runs in 31 Tests with two hundreds and nine half-centuries.
The current Test is Bangladesh's 76th since their entry in 2000.