Sri Lanka were in danger of an innings defeat after losing 12 wickets on the third day of the third and final Test against South Africa at Newlands on Thursday.
Sri Lanka were 138 for four in their follow on innings at the close, still 203 runs short of making South Africa bat again.
South Africa's fast bowlers, backed by the leg spin of Imran Tahir, put Sri Lanka's batsmen under inexorable pressure after the first two days of the decisive Test were dominated by batsmen.
Only six wickets fell while 729 runs were scored in the first two days but it was a complete contrast on Thursday as 12 wickets fell for 228 runs despite conditions remaining largely favourable for batting.
Sri Lanka were bowled out for 239 in their first innings, with fast bowlers Dale Steyn and Vernon Philander taking three wickets apiece.
Philander struck again in the fourth over of the follow on when Tillekeratne Dilshan drove loosely at a ball which moved away, edging a catch to wicketkeeper Mark Boucher.
Lahiru Thirimanne and Kumar Sangakkara showed some fight in a second wicket stand of 67, although Thirimanne should have followed his fellow opener to the pavilion when he was on 10. He edged Morne Morkel and Boucher put down a straightforward chance.
Thirimanne made 30 before he was caught at short leg off Jacques Kallis after umpire Richard Kettleborough initially gave him not out.
South Africa asked for a review and the 'hot spot' revealed a faint edge from his bat before the ball looped from his thigh pad to Hashim Amla.
Tahir gave Sangakkara a difficult time, bowling into rough outside the left-hander's off stump, before having the batsman caught at slip for 34 when he went back to a ball which bounced sharply.
Morkel claimed the key wicket of Mahela Jayawardene with the assistance of a diving catch at second slip by Kallis.
Thilan Samaraweera and Angelo Mathews added an unbeaten 40 for the fifth wicket before the close.
Sri Lanka collapsed in their first innings, losing eight wickets for 90 runs after resuming on 149 for two.
Steyn took three for 56 and Philander three for 46. Both bowled superbly on Thursday, with Steyn's figures for the day an impressive three for 16 off eight overs, while Philander was even better, his three wickets costing 12 runs off nine overs.
Steyn struck with the third ball of the day when Sangakkara sliced a drive to point without adding to his overnight score of 35.
Jayawardene and Samara-weera stayed together for more than an hour before Philander accounted for Samaraweera, who was caught at second slip for 11.