Debutant Kyle Abbott picked up seven for 29 to destroy the Pakistan middle order as they were bowled out for 156 and were asked to follow on, finishing the day 14 for one, still 239 runs behind Graeme Smith's side.
Beginning the day 334 for six, the home side finished on 409 all out, with AB De Villiers (127) and Hashim Amla (92) leading the way, with the former's 129-run stand with Vernon Philander (74) putting them in control.
Rahat Ali took six wickets for 127 runs for the visitors, but Pakistan's batsman failed to replicate his impressive performance.
De Villiers got the two needed for his 16th Test century in just the second over of the day, before Philander registered his 50 two overs later.

