Sangakkara, who struck his maiden triple century in the first innings, hit a six off Sohag Gazi to reach three figures in the second and emulate former England opener Graham Gooch's 1990 feat against India at Lord's.
The 36-year-old left-hander was then bowled by the off-spinner's next delivery as he attempted to sweep on the fourth day.
Sangakkara's fluent 144-ball knock included 11 fours and two sixes.
His tally of 424 fell just short of Gooch's record of 456 for most runs in a single Test.
His partner in a fourth-wicket stand of 145, Dinesh Chandimal, struck his third Test century as Sri Lanka declared on 305 for four half an hour just before the close.
Bangladesh openers Tamim Iqbal and Shamsur Rahman then survived eight overs to leave their side on 12 for no wicket.
Earlier, the home team resumed on 409 for eight but folded for 426 with spinner Ajantha Mendis claiming the last two wickets to finish with six for 99.
Mahmudullah then removed both openers and fellow spinner Shakib Al Hasan trapped Mahela Jayawardene lbw to reduce Sri Lanka to 78 for three before Sangakkara and Chandimal rallied.
Scorecard
Sri Lanka (1st innings): 587
Bangladesh (1st innings): (overnight 409-8)
Tamim Iqbal b Lakmal 0
Shamsur Rahman b Mendis 106
Imrul Kayes b Mendis 115
Mominul Haque lbw b Perera 13
Shakib Al Hasan c Karunaratne b Perera 50
Mushfiqur Rahim c Silva b Perera 20
Nasir Hossain c Chandimal b Mendis 42
Mahmudullah c Silva b Mendis 30
Sohag Gazi lbw b Mendis 0
Al-Amin Hossain b Mendis 9
Abdur Razzak not out 11
Extras: (b-8, lb-1, nb-21) 30
Total: 426
Fall of wickets: 1-0, 2-232, 3-252, 4-259, 5-319, 6-350, 7-396, 8-396, 9-409
Bowling: Lakmal 25-6-70-1, Pradeep 15-2-96-0 (nb-13), Mendis 29.5-3-99-6 (nb-8), Perera 39-4-119-3, Mathews 11-1-33-0
Sri Lanka (2nd innings):
Dimuth Karunaratne c Hossain b Mahmudullah 15
Kaushal Silva lbw b Mahmudullah 29
Kumar Sangakkara b Gazi 105
Mahela Jayawardene lbw Shakib 11
Dinesh Chandimal not out 100
Angelo Mathews not out 43
Extras: (lb-2) 2
Total: (for 4 wickets declared) 305
Fall of wickets: 1-36, 2-49, 3-78, 4-223
Bowling: Al-Amin Hossain 7-1-31-0, Sohag Gazi 18.5-1-87-1, Shakib Al Hasan 22-2-80-1, Mahmudullah 18-4-46-2, Mominul Haque 7-0-46-0, Nasir Hussain 3-0-13-0.
Bangladesh (2nd innings):
Tamim Iqbal not out 7
Shamsur Rahman not out 4
Extras: (b-1) 1
Total: (for no wicket) 12
Bowling: Lakmal 3-0-9-0, Perera 4-3-1-0, Mendis 1-0-1-0
Sri Lanka lead series 1-0
Image: Kumar Sangakkara
Photograph: Getty Images
Sangakkara's triple ton puts Sri Lanka in command
Stylish centurion Sangakkara sparkles for Sri Lanka in 2nd Test
Kaushal Silva hits maiden Test ton as Lanka swell lead vs Bangladesh
Pietersen criticised for 'letting ego come before England's needs'
Sri Lanka crush Bangladesh with a day to spare