Duanne Olivier took his third five-wicket haul of the series before Pakistan's bowlers fought back on the second day of the third and final Test against South Africa on Saturday.
But the hosts were unable to forge a position of dominance, struggling to 135 for five at the close, an overall lead of 212.
Remarkably, in comparison with what has happened earlier in this match and previously in the series, only 8 wickets fell on day three as Hashim Amla and Quinton de Kock made their overnight partnership for the sixth wicket worth 102 before the former departed (71 off 144 balls, 14 fours).
Imamul Haq avoids a bounce.
Abbas was caught by De Bruyn at slip and three balls later Asad Shafiq left his hands and bat above his head as he tried to duck a bouncer and edged to De Kock behind the stumps.
Sarfaraz has had a hot-and-cold series in South Africa with the bat, but behind the stumps Pakistan's captain has been ever-reliable as he picked up 19 dismissals in the three-match Test series, topped off with a record-breaking 10 catches during the third Test at the Wanderers.
Philander removed Shan Masood for two runs and then had Azhar Ali out first ball to bring to nine the number of wickets in a dramatic final session on what was supposed to be a docile wicket at the Wanderers. South Africa also missed two run-out opportunities.
Imam's luck finally ran out when he steered a Vernon Philander (3-43) delivery to Dean Elgar at slip to leave the tourists on 111 for five at lunch.
Kagiso Rabada ended the stand when Sarfraz was caught at first slip and four balls later Olivier had Azam caught at long leg. Olivier made it a double strike when Faheem Ashraf was out first ball, splicing a mistimed pull to short leg. He had match figures of 11 for 96, prompting South Africa to opt for a four-man pace attack when Philander returned for the second Test.
The South African innings was in disarray when Ashraf dismissed both Theunis de Bruyn and new cap Zubayr Hamza in the space of two balls before Amla and Temba Bavuma (23) added 48 for the fifth wicket. Abbas received another reprieve when Quinton de Kock dived to his right but could not hang on to the ball, much to the disgust of Dale Steyn, who went off the field momentarily clutching at his right shoulder which he injured two years ago.