Jacques Kallis hit his second Test double century and AB de Villiers added a thrilling hundred before South Africa declared on 580 for four on the second day of the third and final Test against Sri Lanka at Newlands on Wednesday.
Sri Lanka were 149 for two at stumps as they set out on the massive task of playing themselves back into the match after captain Tillekeratne Dilshan's decision to send South Africa in backfired spectacularly.
Dilshan made a significant contribution with the bat, scoring a 79-ball 78 before Imran Tahir had him caught Graeme Smith.
Kumar Sangakkara was unbeaten on 35 and giving him company was Mahela Jayawardene on seven when the stumps were drawn.
The visitors are 431 runs adrift of the hosts' first innings total with eight of their wickets intact.
Earlier, Kallis made a career-best 224 and De Villiers hit an unbeaten 160 before the home team declared.
Kallis was out in the last over before lunch when he was caught at mid-on by Angelo Mathews off left-arm spinner Rangana Herath. His 325-ball innings included 31 fours and a six while his fourth wicket partnership with De Villiers was worth 192 for his team.
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.
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.