Opener Dilshan scored an impressive 126 and Sangakkara a solid 105, his second hundred of the match, as the hosts declared their second innings at 335-4 at tea.
They added 219 runs to their overnight total of 116-1, and leave Bangladesh chasing an improbable 268-run victory target in the last session.
The flat track at the Galle International Stadium has so far produced eight centuries, which equals the record of most tons in a Test set during the West Indies-South Africa match at Antigua in 2005.
Sangakkara completed his 32nd century, the highest by a Sri Lankan in Tests, with a single off off-spinner Mohammad Mahmudullah. He hit 10 fours in his 172-ball knock.
The former captain, who scored a brilliant 142 in the first innings, also became the fifth Sri Lankan to make a century in each innings of a Test after Duleep Mendis, Asanka Gurusinha, Aravinda de Silva and Dilshan.
Dilshan, 63 overnight, played some good shots in the opening session and reached his 16th Test hundred when he turned left-arm spinner Elias Sunny to square-leg for a single.
Dilshan and Sangakkara fell in the space of 19 runs after lunch, but not before putting on 213 for the second wicket.
Sangakkara, 49 overnight, was caught by Jahurul Islam off Mahmudullah at short mid-wicket while Dilshan was caught by Abul Hasan at deep square-leg off the same bowler after hitting nine fours in his 190-ball knock.
Bangladesh were bowled out for 638 in their first innings on Monday in reply to Sri Lanka's 570-4 declared.
Skipper Mushfiqur Rahim top-scored with 200, the first Test double-century by a Bangladeshi batsman. Mohammad Ashraful (190) and Nasir Hossain (100) were the other main scorers.