The Australians, leading by 162 runs after the first innings, were sailing along at 77 without loss before a tumble of wickets gave SA renewed heart with two days left.
At the close, Australia were 111 for five with Michael Clarke on nine and Mike Hussey not out five. That gave the hosts a lead of 273. Rory Kleinveldt bowled his team back into the contest with three wickets in 18 balls.
“What we did tonight in the last session was exactly what we needed to still have a sniff in the game. And we did that,” Faf du Plessis said.