The 24-year-old skipper, who also keeps wickets, reached the landmark in the second over after lunch on the fourth day when he pushed seamer Nuwan Kulasekara for a single to the covers.
Rahim was 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 during 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.
Photos: Shahid Kapoor, Kangana Ranaut, Saif Ali Khan promote 'Rangoon'
Birthday special in pics: A look at the fastest bowlers in cricket history
Photos: Sachin Tendulkar spotted at Mehboob Studio
Photos: Priya Dutt, Smita Thackeray day out with dogs
Photos: Vidyut Jammwal and Adah Sharma promote 'Commando 2'