Cape Town: Fast bowler Morne Morkel took his 300th Test wicket as South Africa bowled themselves into a strong position on the second day of the third Test against Australia at Newlands on Friday.
Australia were 245 for nine when bad light ended play, 66 runs behind South Africa's first innings total of 311.
But it could have been worse for Australia. They were in deep trouble at 175 for eight before Nathan Lyon hit a Test-best 47 in a ninth wicket partnership of 66 with Tim Paine, who was unbeaten on 33.
Morkel, who will retire from international cricket after the series, took three of the first four Australian wickets to fall and became the fifth South African to join the 300 club.
Morkel dismissed Usman Khawaja and Steve Smith in his first spell, then came back to break a 78-run fourth wicket stand between Cameron Bancroft and Shaun Marsh when Marsh flashed at a wide ball and was caught behind.
Bancroft made 77 off 103 balls with 14 fours but was leg before wicket to Vernon Philander in the last over before tea to leave Australia in a precarious position.
Morkel, 33, playing in his 85th Test, took a fourth wicket when Lyon's adventurous 38-ball innings was ended by a catch by Dean Elgar running back from point.
Earlier, Kagiso Rabada was hit for five boundaries in a row by David Warner but won a duel with the Australian opening batsman when he sent Warner's off stump cartwheeling.
Warner was bowled for 30. He hit three fours off the last three balls of Rabada's second over, then hooked the first ball of Rabada's next over for six.
He sliced a no-ball for four, then was bowled by a ball which went between bat and pad with Warner stuck on his crease.
Rabada, who had a two-match ban for making contact with Australian captain Steve Smith overturned before the Test, ran down the wicket to celebrate but did not go near the batsman.
But Warner appeared to react to a comment from a spectator in the members' pavilion, stopping and turning as he climbed the steps to the dressing room.
South African opening batsman Dean Elgar equalled a world record when he carried his bat through a completed innings for the third time.
Elgar finished unbeaten on 141. Only Desmond Haynes of the West Indies had previously batted through a Test innings on three occasions.
Smith also equalled a world record when he caught South Africa's last two batsmen for a total of five catches in the innings, the joint most by a fielder.
Although ten other fielders shared the record, Smith was only the second Australian to achieve the feat after Vic Richardson in 1935/36.
Elgar and Rabada frustrated the Australians for 50 minutes as they took South Africa's overnight total from 266 for eight. They shared a partnership of 50 before off-spinner Nathan Lyon had Rabada caught by Smith at slip for 22 off his first ball of the day.
Elgar batted for 434 minutes, faced 284 balls and hit 20 fours and a six.