Sri Lanka's Kumar Sangakkara took his run total for the second Test against Bangladesh to 424 in Chittagong.
Sangakkara made 105, to add to his first-innings 319, to become only the fourth player to reach 400 runs in a Test match.
His ton, combined with an unbeaten 100 from Dinesh Chandimal, helped Sri Lanka set Bangladesh a daunting target of 467 to win, leaving the hosts needing to bat out the final day to save the match.
The tourists declared their second innings on 305 for four, with their hosts 12 without loss at the close.
Ajantha Mendis claimed the final Bangladesh first-innings wicket on Friday morning to finally dismiss the home side for 426 before their opponents set about extending their advantage.
Mahmudullah slowed them early on, taking the wickets of openers Dimuth Karunaratne, caught at first slip by Nasir Hossain for 15, and Kaushal Silva, who went lbw for 29.
Sangakkara proved their nemesis again, though, as he plundered another ton, hitting two sixes and 11 fours in his 144-ball knock before becoming the fourth man out, bowled between bat and pad by Sohag Gazi.
It saw him join Graham Gooch (456), Mark Taylor (426) and Brian Lara (400) as the only players to reach 400 in a Test.
Sri Lanka had already lost Mahela Jayawardene for only 11, Shakib Al Hasan with the wicket, but Sangakkara and Chandimal combined for a partnership of 145 which all but ended Bangladesh's slim victory hopes.
Angelo Mathews joined Chandimal when Sangakkara finally went, making a swift 43 before the tourists decided they had enough.
Tamim Iqbal was on seven and Shamsur Rahman on four in the early stages of the hosts' reply at the close.
Sri Lanka won the first of the two-match series by an innings and 248 runs in Dhaka.