(CNN) -- South Africa took three late wickets on day four of the third Test against England to put themselves in a strong position to level the series when they resume on Thursday at Newlands.
England were set a imposing 466 to win and Andrew Strauss and Alastair Cook laid the platform for a record run chase after they put on 101 for the first wicket.
Cook reached his half-century from 105 balls but was the first England batsman to go after he added only five more runs before he miscued a pull shot and Mark Boucher took a high catch in the first over of a new spell from Friedel De Wet.
The tourists then lost their captain for 46 when Strauss fell bat-pad to left-arm spinner Paul Harris only three overs later.
Kevin Pietersen survived one lbw shout after Daryl Harper's initial verdict from a De Wet delivery was overturned following a television referral which revealed an inside edge.
But the South African-born England batsman went shortly for six after he missed a straight delivery from paceman Dale Steyn and was trapped lbw.
Jonathan Trott patiently made an unbeaten 24 from 46 deliveries and he will resume with nightwatchman James Anderson as England reached 132 for three at stumps.
Earlier, South Africa had declared on 447 for seven having resumed on of 312-2 on Wednesday morning with captain Graeme Smith adding 21 runs to his overnight score of 162 before he was caught by Paul Collingwood off the bowling of Graham Onions.
Jacques Kallis (46) then edged behind to Anderson before brisk knocks from JP Duminy (36), AB de Villiers (34) and Boucher (15) gave Smith a total with which he felt comfortable declaring as Anderson and Graeme Swann collected three wickets apiece.
After the close of play Cook admitted that England must look to past situations if they are to pull off pull off a second great escape of their South Africa tour.
"We've got to take a lot of confidence from the situations we've been in, at Cardiff - and the first Test here - where we've managed to scrape out a draw," Cook told reporters.
"We've got the fighters to do that, in the right positions - so we hope we can do it one more time."