Published: 2017-03-10 18:24:28 BdST
Tharanga made 115 and Dinesh Chandimal scored 50 not out before Sri Lanka, who had taken a 182-run first-innings lead, declared their second on 274 for six at the Galle International Stadium.
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.