Pakistan 248 and 109 for 2 (Azhar 37*, Younis 11*) need 342 more runs to beat South Africa 380 and 318 for 2 dec (Amla 118*, Kallis 135*)
Scorecard and ball-by-ball details
South Africa will be confident of taking a series lead on the final day in Dubai after setting Pakistan a huge 451 then extracting two wickets during a hard-working final session. Jacques Kallis and Hashim Amla laid the platform with methodical centuries in an unbroken 242-run stand which left Pakistan needing to bat 131 overs for safety. Although they didn't fold under the evening sunset surviving an entire day is a major task for a brittle batting line-up.
Azhar Ali again showed commendable stickability at the crease and his early performances in Test cricket suggest he has the temperament for a long rearguard, but he could struggle on the final day after a painful blow on the thumb from Dale Steyn in the penultimate over. It will have to be down to him, Younis Khan and Misbah-ul-Haq to do the bulk of the match-saving because the rest don't offer much encouragement.
The loss of one wicket before the close would have been acceptable for Pakistan, but Taufeeq Umar drove loosely at Johan Botha to give Kallis a sharp catch at slip having defied 92 balls. It was a poor choice from Taufeeq - driving out of the footmarks - because Botha has been the most dangerous spinner on show in the game, able to extract more bounce than the others. Botha and Paul Harris will expect a lot of work on the final day with an aim to string together maidens and test the batsmen's concentration.
South Africa, though, will be concerned about the fitness of Steyn after the fast bowler needed treatment on the boundary edge for a problem with his arm. He made the first breakthrough when Mohammad Hafeez, after a positive 34, was caught at first slip and he didn't appear greatly hindered initially but was clearly grimacing later in the session. Fears were partly allayed when Steyn returned late in the day and produced the fearsome bouncer that Azhar gloved over slip but his bowling arm was heavily strapped.
South Africa had delayed their declaration until 40 minutes before tea which was on the conservative side but that is the way they play their cricket. There was nothing in recent history to suggest Pakistan had a chance of chasing anything significant in the fourth innings and if time becomes tight at the end Graeme Smith may wonder if he needed to bat on.
Kallis and Amla had eased along to an unbroken stand of 242, South Africa's second-highest for any wicket against Pakistan. Kallis' hundred was the 36th of a mighty career - and included four sixes, the most he has hit in a Test innings since 2005 - while Amla's was number 11 for an increasingly prolific batsman. As a partnership they were as remorseless as batting can become, even if many of the runs were easy pickings.
The match was already getting out of Pakistan's reach when play started, but when they failed to break through in the first 20 minutes it became a waiting game as South Africa piled on the runs. Misbah soon set his field back, abandoning all pretence of taking wickets, and tried to slow the scoring. Ironically, one of their best chances to strike came when Kallis edged a Saeed Ajmal doosra through the vacant slip area - but the lead was already at 350.
Kallis was the aggressor during the first session and signalled his positive intent by launching his first ball of the day, from Ajmal, over the sightscreen. It was a moment that took everyone by surprise and for the rest of the first hour he was content to work the ball around. After drinks, he briefly cut loose with 16 coming off another Ajmal over when Kallis cracked him straight for another six and then slog-swept over midwicket.
Amla continued his wonderful form with an innings full of stylish touches. He opened his account for the day with a crisp back-foot drive off Umar Gul, and then rocked back to pull him through midwicket. His second fifty of the match came from 104 balls, although he was fortunate to survive an lbw appeal against Ajmal on 58, off a delivery that would have hit leg stump.
The pair paced each other through the 90s and Amla won the race to three figures, reaching his ton off 190 balls, before Kallis joined him there in the next over, from 185 deliveries. As the partnership pushed on Pakistan became increasingly ragged in the field, with Gul dropping Kallis at deep square-leg on 124, but their ambitions had long-since become trying to deny South Africa a win. If they manage that on the final day it will feel like a victory.
Andrew McGlashan is an assistant editor at Cricinfo