Kumar Sangakkara became only the second cricketer to hit a triple century and a hundred in the same test as Sri Lanka set Bangladesh a huge target of 467 to win the second and final match in Chittagong on Friday (local time).
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.
What do you make of the recent crackdown on chucking in cricket?