Potchefstroom: South Africa claimed three top-order Bangladesh wickets to take a firm grip on the second day of the first Test at Senwes Park on Friday.
Bangladesh were 127 for three at the close, still trailing by 369 runs after South Africa declared their first innings on 496 for three.
Dean Elgar made 199 and Hashim Amla scored 137 as South Africa batted remorselessly until tea before captain Faf du Plessis declared.
The declaration caused a problem for Bangladesh because regular opener Tamim Iqbal had been off the field towards the end of South Africa's innings, which meant he had to wait for 48 minutes before he could bat.
Two wickets fell before Tamim's enforced absence came to an end and he eventually batted at number five.
It was the first time in his 52-Test career that he had not faced the first ball of an innings.
Kagiso Rabada made an early breakthrough for South Africa when Imrul Kayes gloved a catch to gully in the sixth over.
Morne Morkel followed up with the wicket of emergency opener Liton Das, who made a spirited 25, including two successive pulls for four off Morkel, before edging the tall fast bowler to first slip.
Bangladesh captain Mushfiqur Rahim made an aggressive 44 off 57 balls but was fortunate to survive two sharp chances to Elgar at slip off left-arm spinner Keshav Maharaj when he was on six and 15.
He eventually fell to Maharaj, caught off bat and pad at short leg.
Tamim joined Mominul Haque and the two left-handers batted through to the close, unbeaten on 22 and 28 respectively, with Tamim epitomizing Bangladesh's attacking approach by dancing down the wicket to hit Maharaj for six off the last ball of the day.
Opening batsman Elgar and Amla put on 215 for the second wicket as South Africa again gave Bangladesh cause to regret their decision to send the hosts in to bat.
Amla became the first batsman to fall to a bowler when he slashed a wide ball from Mustafizur Rahman to backward point in the first over after lunch.
The left-handed Elgar, who had gone past his previous highest Test score of 140, looked set for a double century until an attempted pull shot against Shafiul Islam looped off a top edge to short midwicket. He had batted for more than nine hours and faced 388 balls. He hit 15 fours and three sixes.
Amla went to his 27th Test century in fluent style. He joined former captain Graeme Smith as the country's second-highest century-maker, behind only Jacques Kallis, who made 45. Amla scored his runs off 200 balls with 17 fours and a six.