Openers Stiaan van Zyl (13 not out) and Dean Elgar (10 not out) remained unbeaten to trim the visitors' deficit to 55.
Wicketkeeper-batsman Litton Das made 50, his maiden Test 50, after putting on 82 runs in a stand with Shakib Al Hasan (47) for the sixth wicket, as Bangladesh posted their highest Test score against the world's number one ranked side.