The New Zealand batting maestro completed his 13th Test century, and fifth of the year, as the Black Caps knocked off the 47 runs required for victory on day four of the second Test.
The honour of completing the formalities went to BJ Watling with a single to get New Zealand to their 189 target but the result belonged to the 25-year-old Williamson.
He reached a number of milestones in his 108 not out as New Zealand followed up their 122-run triumph in the first Test in Dunedin.
Williamson was in no mood to hang around when he resumed the day on 78, taking a four off the second delivery from Dushmantha Chameera, Sri Lanka’s most effective bowler.
His century came from a similar shot with a boundary through square off Chameera which also took him past Brendon McCullum’s New Zealand record of 1,164 Test runs in a calendar year.
As Williamson accumulated the runs, Watling put up a brick wall defence at the other end, facing 20 deliveries before getting off the mark while Williamson added 26 in the same period.
Williamson ended the year with easily the best average of established Test players at an incredible 90.15 with the next best, Australian Adam Voges, averaging 76.83.
He set a New Zealand record of 1,172 for Test runs in a calendar year and has now scored 2,633 in all internationals this year.
His 13 Test centuries takes him to second equal on the New Zealand list with Ross Taylor and four behind the record of 17 set by Martin Crowe.
In a Test where both sides struggled with short-pitched bowling, including Williamson in his four-ball first innings, his second turn with the bat was a masterclass of technique in keeping the ball on the deck.
He faced 164 balls and produced 12 fours and only one six.
New Zealand’s chances of winning the match appeared remote as they neared lunch on the third day with Sri Lanka adding 71 to their first innings 55-run lead.
But in a bizarre session of cricket, they crumbled in the face of New Zealand’s short-pitched barrage to be all out for 133, with their 10 wickets evaporating for 62.
Chameera, who came of age as an international bowler in this Test, also employed the short ball to good effect, and had New Zealand at two for 11 in their second innings before Williamson took command.
The 23-year-old Chameera, in only his fourth Test, finished with four for 68 to give him nine wickets for the Test.
New Zealand have now gone unbeaten in 13 home Tests, overtaking their previous best unbeaten home run of 12 set between 1987-1991. (Courtesy IBN Live)