The Proteas managed to stifle the run rate and frustrate the batsmen, with all four of their seamers impressive as they exploited the variable bounce and cracks in the pitch.
The difficult batting conditions make the home side's first innings total of 409 seem all the more impressive.
Imran Farhat (30) had already survived an lbw dismissal from Rory Kleinveldt that was overturned on review when he was trapped in front by Vernon Philander.
The partnership of 46 that Farhat had put on with Mohammad Hafeez was comfortably Pakistan's best opening wicket stand of the series - the tourists had not managed to get into double figures in the two previous Tests.
But if the start was promising, things soon unravelled. Hafeez (18) became the first Test victim for South African debutant swing bowler Kyle Abott as he was caught at gully by Dean Elgar in the paceman's first over.
With the next ball Philander removed Azhar Ali (six) after his off-stump was knocked back by a ball that kept low and took the edge of the bat.
Younus Khan and Misbah-ul-Haq (10) advanced the score to 75 before the latter edged Abbott to Alviro Petersen at second slip and he pulled off an excellent low catch to his left.
Younus (13 not out) and Asad Shafiq (two not out) will resume in the final session, needing a partnership close to the 219 they put on in the second Test in Cape Town to get Pakistan near South Africa's first innings total.
Earlier, a century from AB de Villiers helped South Africa past the 400-mark before they were all out just before lunch.
De Villiers (121) reached his century off 186 balls, needing just two runs on the second morning to complete the milestone.
The visitors took the remaining four South African wickets for the addition of 75 runs on the second morning with Rahat Ali recording career best figures of six for 127 in his second Test.
South Africa lead the three-match series 2-0 having won the first Test in Johannesburg by 211 runs, before clinching the series with a four-wicket victory in Cape Town.
- Sports & Recreation
- South Africa
- Imran Farhat
- Mohammad Hafeez