Ackerman and Hamza steadied the innings, with the former moving to his half-century from 68 balls, including nine fours, as the second-wicket stand continued to put Bangladesh's bowlers under pressure.
The Proteas reached 100 in the 22nd over, with Ackerman on 60 and Hamza on 34, before the pair carried the score to 129/1 at tea.
Ackerman was 69 not out and Hamza 48, leaving SA 271 runs behind with nine wickets in hand.
Hamza completed his half-century from 82 balls after the partnership grew to 150 from 197 balls with SA reaching 190/1 at the second drinks break.
Ackerman then reached his century from 125 balls, having struck 14 fours, as the second-wicket partnership passed 200.
The partnership finally ended at 207 when Hamza was dismissed for 83, caught by Das off Mominul Haque.
They added 202 runs to transform SA's position.
Ackerman continued to attack, even after Hamza's dismissal, reaching 150 from 160 balls with 21 fours before his remarkable innings ended on 157 at 268/3, caught by Taskin Ahmed off Hasan Mahmud.
Hasan struck again late in the day to remove Matthew Breetzke for two.