Rabada, recently ranked the No. 1 bowler in test cricket, has also previously been disciplined three times for his actions after dismissing batsmen and served a one-test ban in England past year.
The Aussies consolidated after that and an 87-run stand for the fifth wicket between Khawaja and Mitchell Marsh helped them resuscitate the innings until the former's departure nine minutes before stumps.
David Warner was in the midst of the action once again, this time on the receiving end of another over-the-top celebration from fast bowler Kagiso Rabada, as Australia fought to stay in the second test in South Africa on Sunday.
De Villiers made a magnificent 126 not out and had good support from the tail as South Africa scored freely before they were all out for 382 shortly before the scheduled lunch break.
"If we get to 50 or 70, those are leads that you can maybe hope to nab one or two wickets before they (draw level)".
The South Africa captain Faf du Plessis wasted both reviews during the final session.
The tourists lead 1-0 in the four-test series.
Australian Prime Minister Praises US Decision to Exempt Canberra From Tariffs
USA trading partners were given a 15 day window to negotiate exemptions to the tariffs, due to come into effect in a fortnight. But Foreign Minister Julie Bishop is emphatic there is no new security or military arrangement Australia is expected to meet.
He is already facing a disciplinary hearing at this game for bumping into Australia captain Smith after dismissing him in the first innings.
De Villiers, who had not scored a ton in his last 13 tests, featured in an 84-run partnership with Vernon Philander for the eighth wicket as the pair saw off any potential impact of the new ball from an Australian attack that looked exhausted after their exertions on Saturday.
De Villiers and Quinton de Kock put on 44 for the seventh wicket before De Kock was bowled by off-spinner Nathan Lyon with a ball which spun sharply past the outside edge of his bat. Rabada faces a two-test ban if he is found guilty on making contact with Smith intentionally.
South Africa's best batsman set up the winning position.
In contrast, Maharaj opted for an aggressive approach at the crease, smashing three fours and two sixes in a 24-ball knock that further frustrated Australia's attack. He reached 100 off just 117 balls, a free-flowing innings that made batting look much easier than it really was, especially with the ball reverse swinging on Day 2.
The Proteas' last three batsmen managed to assist De Villiers in producing 155 runs.
De Villiers reached his century soon after with an audacious shot over the slips as he was joined by Maharaj, who swatted at the Australian bowling to score 30 off 24 balls before he was bowled by Josh Hazlewood. He returned for the Boxing Day Test against Zimbabwe and has been part of all five Tests against India and Australia since then. He has had a control percentage of over 85 against each of the four major Australia bowlers, best of all against Pat Cummins with 94.94%.