Ryan Rickleton scored 259 runs as South Africa took control on day two of the second Test against Pakistan at Newlands.
Rickleton, who started the day on 176 not out with the hosts 316-4, scored another 83 runs before being caught off the bowling of Mir Hamza shortly before tea.
It was the 28-year-old's first time opening in Test cricket, and his 259 moved him into seventh place for the highest Test score by a South African alongside Graeme Smith against England in 2003.
Captain Temba Bavuma (106) and wicket-keeper Kyle Verini (100) also reached triple figures, while all-rounder Marco Janssen crossed 50 shortly before tea.
Spinner Salman Ali Agha took three wickets, while Hamza and Mohammad Abbas got two each.
South Africa lead 1-0 in the two-match Test series.