Thanks to their industrious partnership, the Black Caps finished the day on 321 for four. They enjoy a seven-run first-innings cushion after restricting South Africa to 314 in their first innings.
The skipper, Williamson, finished undefeated on 148 off 216 balls. He hammered 14 eye-catching fours and three sixes.
With his 17th ton, the New Zealand captain joined Martin Crowe at the summit of the Black Caps’ list of batsman who struck the most centuries for the Kiwi’s. Ross Taylor, on 16 centuries, is second on the list.
South Africa struck three times with the second new ball as Morne Morkel had Raval magnificently caught off the inside edge by Quinton de Kock for 88 after the left-handed batsman had faced 254 balls and struck 10 fours.
Kagiso Rabada trapped Neil Broom in front with an in-swinger for 12 and had Henry Nicholls caught off the glove on the leg-side next ball for a duck.
The Black Caps slipped temporarily from 273 for one to 293 for four.