New Zealand were 304 for eight, four runs behind South Africa's 308 and with only the injured Ross Taylor left to bat.
Williamson faced 241 deliveries for his 130 in a patient 380 minutes in the middle.
The Kiwi skipper fell an hour after lunch, ending an 84-run stand with BJ Watling who was dismissed two overs before tea for 50.
At the crease were Neil Wagner on four with Trent Boult yet to score.
Williamson's century, which saw him draw level with Taylor on 16 -- one behind the late Martin Crowe's New Zealand record of 17 -- came on a hard-fought day of disputed decisions.
New Zealand scored 70 for the loss of two in the first session and could only manage 57 for three wickets in the second.
The crowd booed when the third umpire ruled Jimmy Neesham was out, caught behind for seven, when replays showed Morne Morkel had marginally overstepped the front line.
Watling won an appeal to the third umpire after being lbw for three by spinner Keshav Maharaj.
To the naked eye the ball appeared to be heading towards the bails, but the ball tracker indicated it would have easily cleared the stumps.
When play resumed after lunch, South Africa delayed taking the new ball for nearly six overs, during which time New Zealand added 20 runs.
But when they did take the new ball, Kagiso Rabada used the extra pace and bounce to remove Williamson with a ball that seamed slightly to find the edge of the bat and wicketkeeper Quinton de Kock completed the dismissal.
It has been seven Tests since New Zealand last had a first-innings lead over South Africa.
The last time was in 2012, also at the University Oval, when New Zealand were ahead by 35 going into the second innings, with the Test drawn when the last day was washed out.
Rain is also forecast for the final day of this Test.
Disclaimer: No Business Standard Journalist was involved in creation of this content
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
