South Africa took a vice-like grip on the first Test after Morne Morkel and Johan Botha skittled Pakistan for 248 on the third day at the Dubai International Cricket Stadium on Sunday.
The visitors will take a commanding 271-run lead into the fourth day after reaching 139 for two in their second innings.
Off-spinner Botha dismantled Pakistan's middle order by picking up three quick wickets and Morkel completed a bad day for the designated hosts as he grabbed five for 54.
Pakistan lost their last five wickets for the addition of just 28 runs and face an uphill task to save the Test.
Azhar Ali was the only Pakistan batsman to defy South Africa for any length of time as he ground his way to 56 off 172 balls.
He was eventually dismissed when he fended a Morkel short ball to Hashim Amla at short leg as Pakistan's innings fell away in the face of some disconcerting bounce that Morkel extracted off a lifeless pitch.
Paceman Dale Steyn sparked the collapse after lunch when he had Adnan Akmal (10) caught behind before Botha and Morkel took centre stage.
Off-spinner Botha found both bounce and turn to trouble the batsmen and claimed the scalps of Younus Khan (35), Misbah-ul-Haq (9) and Umar Akmal (4) to bag three wickets for 61.
Morkel had Rehman (1) caught at third slip before he dismissed Ali.
Morkel then ended the innings in the space of five balls when he had both Wahab Riaz (5) and Saeed Ajmal (2) caught by keeper Mark Boucher.
South Africa lost Alviro Petersen (26) and Graeme Smith (34) before an unbroken third-wicket stand of 63 between Amla (44 not out) and Jacques Kallis (32 not out) guided them to the close of play.
Scoreboard
South Africa 1st Innings 380
Pakistan 1st innings (overnight 144-2)
M. Hafeez c Smith b Harris 60
T. Umar lbw b Morkel 42
A. Ali c Amla b Morkel 56
Younis Khan c de Villiers b Botha 35
Misbah-ul-Haq c Amla b Botha 9
U. Akmal c Steyn b Botha 4
A. Akmal c Boucher b Steyn 10
A. Rehman c de Villiers b Morkel 1
U. Gul not out 12
W. Riaz c Boucher b Morkel 5
S. Ajmal c Boucher b Morkel 2
Extras (lb-12) 12
Total (all out; 95 overs) 248
Fall of wickets: 1-105, 2-111, 3-176, 4-196, 5-202, 6-220, 7-225, 8-228, 9-246, 10-248
Bowling: Steyn 18-3-58-1, Morkel 21-7-54-5, Harris 25-7-47-1, Kallis 8-3-16-0, Botha 23-6-61-3.
South Africa 2nd innings
A. Petersen lbw b Rehman 26
G. Smith lbw b Ajmal 34
H. Amla not out 44
J. Kallis not out 32
Extras (b-1, lb-1, nb-1) 3
Total (two wickets; 48 overs) 139
Fall of wickets: 1-47, 2-76
Bowling: Gul 8-0-34-0, Younis 3-0-15-0, Rehman 15-4-37-1, Hafeez 11-3-20-0, Ajmal 11-1-31-1.
Dale Steyn cleared of doping offence
Tendulkar, Sehwag shortlisted for top ICC awards
Bangalore thrash Rajasthan by 10 wickets
Botha appointed South Africa T20 captain
'Chokers' tag not deserved, says Steyn