Sri Lanka lost two wickets after taking a pounding from South African batsmen Jacques Kallis and AB de Villiers on the second day of the third and final Test at Newlands on Wednesday.
Sri Lanka were 149 for two at the close in reply to South Africa's 580 for four declared, a deficit of 431 runs.
Kallis made a career-best 224 and De Villiers hit an unbeaten 160 before the declaration.
Sri Lankan captain Tillekeratne Dilshan hit a dashing 78 before he was caught at deep mid-on off leg-spinner Imran Tahir. Fellow opener Lahiru Thirimanne was earlier bowled by Morne Morkel for 23 as Sri Lanka set out on the massive task of playing themselves back into the match after Dilshan's decision to send South Africa in backfired spectacularly.
South Africa scored at better than four runs an over and were able to declare in mid-afternoon in an attempt to push for a series-clinching victory.
Kallis was out in the last over before lunch when he was caught at mid-on off left-arm spinner Rangana Herath after batting for 435 minutes.
He faced 325 balls and hit 31 fours and a six. His fourth wicket partnership with De Villiers was worth 192.
South Africa added 106 runs in 28.3 overs before lunch before the scoring rate rocketed after the interval as De Villiers and Jacques Rudolph (51 not out) piled on another 127 runs off 20.3 overs in 79 minutes.
De Villiers reached his century off 176 balls and then cut loose, adding another 60 off 29 balls. His innings included 19 fours and two sixes - the latter hit off successive balls from Dilshan.
Kallis, resuming on 159, hit boundaries off his first two balls of the day, from Dhammika Prasad.
But he had an escape on 171 when Prasad was able to make a ball deviate enough off the pitch for Kallis to edge it low to second slip where a diving Mahela Jayawardene got his fingers to the ball but was unable to hold on.
There was more good fortune for Kallis on 183 when he edged Angelo Mathews between wicketkeeper Dinesh Chandimal and Jayawardene, who was at a wide solitary slip.
Kallis, playing in his 150th Test, reached his double century off 280 balls with 29 fours and a six. His previous double century came against India at Centurion last season when he made 201 not out.
Indicative of the dominance of the batsmen, the Sri Lankan bowlers were able to deliver only two maiden overs on Wednesday, both by the left-armed Chanaka Welegedera early in the day.
The pitch continued to play easily when Dilshan and Thirimanne launched Sri Lanka's reply. They put on 70 before the left-handed Thirimanne was bowled by a full-length delivery from Morkel, four runs after being missed at third slip by De Villiers.
Dilshan raced to the fastest half-century of the match, off only 41 deliveries, but fell in Tahir's second over when he went for a big hit but mistimed the ball and was caught by a diving South African captain Graeme Smith two-thirds of the way to the long-on boundary.
Kumar Sangakkara and Mahela Jayawardene, Sri Lanka's two most experienced batsmen, saw their side through to the close.
Follow Emirates 24|7 on Google News.