He also took the last two wickets to finish with five for 52 and match figures of 11 for 60.
Wicketkeeper AB de Villiers held five catches to add to the six he took in the first innings.
He also became the first player in Test history to make a century and claim ten or more dismissals in a match after hitting an unbeaten 103 in the second innings.
Brief scores: South Africa 253 and 275-3 declared beat Pakistan 49 and 268 (Misbah-ul-Haq 64, Steyn 5-52)