Pakistan were bowled out for 378 on the third day of the opening Test in Karachi on Thursday, in reply to South Africa’s first innings total of 220.
Resuming at 308-8, Pakistan added a further 70 runs for the loss of two wickets, stretching their lead to 158.
South African fast bowler Kagiso Rabada finished with 3-70, completing his 200 wickets in 44 Tests by dismissing Hasan Ali for 21.
Rabada is the eighth South African bowler to take 200 or more Test wickets.
On Wednesday, Fawad Alam led Pakistan’s recovery against South Africa after scoring his first Test century at home.
Fawad reached the milestone, his third tonne in Test cricket, with a six over long-on to left-arm spinner Keshav Maharaj.
The two-match Test series is South Africa’s first in Pakistan for 14 years. The second Test will be played in Rawalpindi from February 4.
The hosts have won only one of their previous seven Tests against South Africa in Pakistan, with the visitors claiming two victories to go with four draws.