Bangladesh were 67 for no loss when bad light forced an early close with the tourists still needing 390 runs for an improbable win at a ground where no team has scored more than 300 in the fourth innings.
Soumya Sarkar was unbeaten on 53, his second half-century of the match, with Tamim Iqbal on 13 when play was called off.
Sri Lanka scored briskly after lunch, milking 160 runs in the 31-over session despite losing four wickets.
Tharanga took a single off left-arm spinner Shakib Al Hasan to bring up his century and was eventually bowled by off-spinner Mehedi Hasan Miraz. Tharanga's knock included 11 fours and two sixes.
News that makes sense
Your trusted source for staying up-to-date with the world around you. Get free daily news updates and analysis, straight to your inbox.
(Reporting by Amlan Chakraborty in New Delhi; editing by Ed Osmond)
