It was McMillan's maiden Test century, and he was unbeaten on 106 at the close, as South Africa recovered to 354 for 7 from 168 for 5.
There was a determined performance by the pace bowler, Aamer Nazir, who flew into Johannesburg only 90 minutes before the start of play to replace the injured Waqar Younis.
Nazir struck after McMillan and Jonty Rhodes had put on 157 for the sixth wicket, Rhodes being caught by Inzamam-ul-Haq at slip before Dave Richardson fell to a first-ball yorker.
South Africa were in trouble at the start of their innings, with Wasim Akram having Rudolf Steyn caught by Moin Khan with only one run on the board.
Hansie Cronje (41) joined Gary Kirsten (62) in a 79-run partnership for the fourth wicket before Rhodes and McMillan hit their way out of trouble.
South Africa won toss South Africa - first innings G Kirsten c Aamer Sohail b Kabir Khan 62
P J R Steyn c Moin Khan b Wasim Akram 1
J Commins b Aqib Javed 13
D J Cullinan c Moin Khan b Aqib Javed 0
*W J Cronje c Asif Mujtaba b Kabir Khan 41
J N Rhodes c Inzamam b Aamer Nazir 72
B M McMillan not out 106
D J Richardson b Aamer Nazir 0
C E Eksteen not out 1
Extras (b4 lb17 w6 nb31) 58
Total (for 7, 90 overs) 354
Fall: 1-1 2-55 3-59 4-138 5-168 6-325 7-325.
To bat: P S de Villiers, A A Donald.
Bowling: Wasim Akram 22-4-78-1; Aqib Javed 22.4-4-91-2; Kabir Khan19.1-4-60-2; Aamer Nazir 9.1-0-48-2; Aamer Sohail 13-2-41-0; Salim Malik 4-0-15-0.
Pakistan: Aamer Sohail, Saeed Anwar, Inzamam-ul-Haq, *Salim Malik, Kabir Khan, Ijaz Ahmed, Moin Khan, Asif Mujtaba, Wasim Akram, Aamer Nazir, Aqib Javed.Reuse content