Bangladesh had its best day in three Test series in South Africa but could not prevent the host from moving into a dominant position on the third day of the first Test at Senwes Park on Saturday.
Mominul Haque and Mahmudullah hit half-centuries to enable Bangladesh to avoid the follow-on but its total of 320 was still 176 short of South Africa's first innings total of 496 for three declared.
In contrast to the first day, Bangladesh dismissed both South African opening batsmen cheaply at the start of the second innings.
South Africa was 54 for two when bad light ended play early, an overall lead of 230.
Dean Elgar and Aiden Markram were out for 18 and 15 respectively, after making 199 and 97 in the first innings.
Mominul made 77 - the highest Test score by a Bangladesh batsman against South Africa - and Mahmudullah hit 66 as Bangladesh topped 300 for the first time in nine Test innings in South Africa, where it has lost all four previous Test matches by an innings.
On a slow pitch, Bangladesh had four successive half-century partnerships between the third and sixth wickets.
The tourist batted with positive intent, although much of the good work was undone when it lost its last five wickets for 28 runs, four of them after the second new ball had been taken.
The diminutive Mominul and fellow left-hander Tamim Iqbal saw off some hostile bowling by Morne Morkel and Kagiso Rabada at the start of the day, with the first nine overs producing only seven runs.
Both batsmen survived close leg before wicket decisions against reverse-swinging deliveries from Rabada.
But 17 runs came off Rabada's fifth over of the day, including two successive boundaries by Mominul, and South Africa's change bowlers were unable to maintain the pressure.
The only wicket of the morning fell to new cap Andile Phehlukwayo when Tamim, on 39, glanced an off-target delivery down the leg side and wicketkeeper Quinton de Kock flung himself to his right to take a good catch.
Mominul was well caught at short leg by Markram off left-arm spinner Keshav Maharaj soon after lunch after a 150-ball innings which included 12 fours.
Mahmudullah, strong on the drive, found another useful ally in Sabbir Rahman (30) before both batsmen were dismissed in quick succession.
Rahman played a lifting ball from Duanne Olivier onto his stumps and Mahmudullah fell to the first delivery with the second new ball when an attempted cut against Morkel crashed into his stumps off an inside edge. Mahmudullah faced 124 balls and hit 11 fours and a six.
Maharaj was the most successful South African bowler, taking three for 92.
- Hockey India: Statements by outgoing officials claiming divisions within the organisation are not correct
- Treesa Jolly and Gayatri Gopi Chand - Double(s) delight for Indian badminton
- NBA roundup: Cavs’ Max Strus hits half-court winner at buzzer
- Uday Saharan wins Emerging Hero award at the Sportstar ‘Focus Punjab’ Conclave
- WPL 2024: Royal Challengers Bangalore looks to maintain win-streak as it faces Delhi Capitals