A flurry of wickets in the evening session pegged back the Proteas who had threatened to run away with the game earlier in the day as JP Duminy and Dean Elgar converted their overnight scores into hundreds on a co-operative deck.
South Africa would end the day well placed on 390/6 despite three wickets falling after the tea break.
Duminy and Elgar had dominated the day's play until, in the final over before tea Duminy nicked off to Peter Siddle.
The pair of left-handers recorded the highest third wicket partnership for South Africa in Australia since readmission into international cricket.
The epic 250 run stand gave South Africa a clear advantage as the Test moved passed the halfway mark.
The pair presented few chances to the Australians and took South Africa from 104/2 at the start of play to 183/2 at lunch.
The Australians were made to toil hard on an exceptionally hot day in Perth and despite the occasional bit of variable bounce found it hard to craft any chances with the left-handers at the crease.
Duminy took a shine to the bowling of Mitchell Starc, his strike-rate against the rapid left-armer would end over 80 and he would plunder 5 fours off the bowler.
Starc made a meal of a catch off the bowling of Nathan Lyon to give Elgar a reprieve when the opener was on 81. Starc ran back to catch a steepler but misjudged the height and turned around just in time to see the ball thud to the ground just next to him.
With two quicks returning from injury it was always likely that Josh Hazlewood would need to put in a big shift for the hosts and he did exactly that bowling 32 overs so far in this innings, more than any other bowler.
When Duminy (141) lost his wicket South Africa went to tea on 295/3.
Hazlewood would grab the wicket of Elgar (127) in the 12th full over after tea, a just reward for his hard work on a tough day, he got the left-hander to edge one behind and this prompted a mini-collapse from South Africa.
Temba Bavuma (8) and Faf du Plessis (32) feel as the Proteas stuttered towards the close, with the Mitchell's, Starc and Marsh picking up their first wickets of the innings.
Quinton de Kock (16*) and Vernon Philander (23*) showed aggressive intent and added 38 to the Proteas total to take the visitors to 390/6 by the close of play.