The hosts are 2-1 ahead in the series and need only a draw to beat Australia in a home series for the first time since 1969/70.
Australia, wracked by the fallout from the ball-tampering plot which has led to bans for three of their leading batsmen including skipper Steve Smith, resumed the third day on 110 for six.
But the tail end offered stiff resistance. Pat Cummins made a Test high of 50 off 92 balls as Australia were eventually all out for 221 still 267 runs behind South Africa’s first innings score.
And that tally increased as openers Dean Elgar and Aiden Markram hit 54 before Markram was out for 37.
The 23-year-old’s innings took him to exactly 1,000 runs in 18 Test innings. Only former South Africa skipper Graeme Smith was more prolific. He needed 17 innings to pass 1,000 Test runs.
Elgar finsihed the day on 39 not out and the skipper, Faf du Plessis, on 34.