Pakistan 181 (Babar 71, Olivier 6-37) & 190 (Masood 65, Imam 57, Olivier 5-59) lead South Africa 223 (Bavuma 53, Amir 4-62, Afridi 4-64) by 148 runs
The Centurion Test continued to twist and turn on the second day as South Africa secured a 42-run lead before Pakistan eased to 101 for 1 and then imploded after tea to be bowled out for 190. Duanne Olivier added to his six-wicket haul in the first innings with 5 for 59 in the second to record match figures of 11 for 96 - the-third best figures in Tests at this ground. Imam-ul-Haq and Shan Masood drove Pakistan forward with fifties but there were also three ducks in the visitors' second-dig collapse, with captain Sarfraz Ahmed bagging a pair. South Africa will need to chase just 149 on Friday to win the match in three days.
Pakistan's top order had looked much more assured in the second session, with Imam and Fakhar Zaman erasing South Africa's lead before Imam combined with Masood in a 57-run second-wicket stand that put Pakistan in the comfortable position of 100 for 1 at tea, a lead of 58. But when Imam fell in the opening moments of the evening session, chopping Olivier onto his stumps for 57, South Africa had their opening.
Azhar Ali got himself in an awful muddle attempting a pull at an Olivier bouncer, spooning a catch to a diving Kagiso Rabada at short midwicket to fall to the third ball he faced. Olivier had his tail up, bowling a splice-jarring length at express pace, and Dale Steyn quickly won his battle with a flat-footed Asad Shafiq, but it was Rabada who tore through the lower-middle order, nipping Babar Azam, Sarfraz and Mohammad Amir out in successive overs. While Babar was undone by a peach of a delivery, Sarfraz chased a ball outside off and Amir was castled by one that kept low.
With the rearguard wrecked, Olivier picked up his tenth wicket in the match when Yasir Shah edged the very first ball he faced - predictably, a bouncer - through to Quinton de Kock. Pakistan were 159 for 8, and amid the carnage, only Masood had stood firm, bringing up a 77-ball fifty in the 39th over of the innings.
Masood survived a review when South Africa thought he had gloved a short ball from Olivier, and with Hasan Ali for company, played his shots to counter Olivier's head-hunting length. Together they had stretched Pakistan's lead to 143 when Steyn returned and Masood played one pull too many, picking out Keshav Maharaj at deep midwicket - one of three fielders in the deep on the leg side.
The dismissal gave Steyn his 50th wicket against Pakistan in Tests, but fittingly it was Olivier who brought the innings to a close. An unsettled Shaheen Afridi fended yet another short one into the leg side, with Aiden Markram at short leg holding on to an excellent reflex catch, and Pakistan's collapse was an eye-watering 9 for 89.
Their capitulation stood in stark contrast to the grit displayed by the top three after lunch. Imam had been the lucky recipient of a missed chance by Hashim Amla at first slip in the fifth over of the innings, but he made the drop count to keep South Africa sweating through the second session. He and Fakhar rode their luck to take Pakistan level before Fakhar fell against the run of play, lifting a leg-stump half volley from Olivier straight to Rabada at fine leg - the only fielder in the deep on that side of the pitch.
Imam was unflustered by the dismissal, easing to a 71-ball fifty, and the assurance of his and Masood's batting gave no hint of the havoc that would come. But the character of the pitch has meant that the bowlers have controlled this fast-moving Test throughout, and South Africa had been similarly tested this morning - though the results weren't quite as catastrophic for them.
With Amir probing with both the new and old ball, and none of the South African top five reaching 30, the hosts were thankful for the efforts of Temba Bavuma and de Kock, who carried them to 223 and a slim lead.
De Kock looked to play as he usually does, simplifying his attacking intent, and Bavuma looked the picture of composure as he eased calmly to his third Test fifty in the calendar year. But there was enough in the track, even with the old ball, to keep the bowlers interested and Bavuma admitted at the end of the day that he "never felt in".
He edged Afridi behind shortly before drinks in the morning, but de Kock put South Africa ahead with a languid drive and continued to pepper the cover boundary. Judicious use of the review helped prise Maharaj from the crease, and Rabada entered and played his shots before he and de Kock fell in quick succession with South Africa having earned a small, but handy lead.
That lead looked far more useful when Pakistan folded in spectacular session in the evening, and as had been the case on the first day, 15 wickets fell in the day. Much could depend on the first hour of the third morning. If South Africa can get a solid start, their chase could be a simple one. But Pakistan have the personnel and a pitch that could yet add a final twist on day three if they can strike early. Either way, the match could well be over before the thunderstorms predicted on Friday afternoon afternoon get close to the ground.