Guptill, who had received a tacit warning he may have been playing for his place in the side, struck his third test century, while Williamson fell just short of his 13th as they combined in a record 173-run second wicket partnership.
McCullum, who is likely to be playing his final Test in his home city before his expected retirement after the World Twenty20 in March, then smashed Sri Lanka's bowlers around the picturesque University Oval to accelerate his side's innings.
McCullum scored 75 runs from 57 balls in a little under an hour before his side reached the close of the first day on 409-8, with Doug Bracewell on 32 and Neil Wagner yet to score after the visitors took six wickets in the final session.
The 34-year-old McCullum made a streaky start but opened up to dominate the 89-run fourth-wicket stand with Guptill (156), who had earlier put the hosts in a strong position with Williamson.
Guptill, who had a poor run in the recent Australia series, was finally dismissed with five overs remaining when he was caught by wicketkeeper Dinesh Chandimal off Angelo Mathews.
Williamson, who has scored almost 1,000 test runs in 2015, never appeared in trouble at the crease as he guided the ball around the field at will before he was well caught at slip by Dimuth Karunaratne off Nuwan Pradeep for 88 just before tea.
The pair had stymied any assistance the visitors had hoped to extract from the green-tinged pitch after winning the toss.
It was a record second-wicket stand for New Zealand against Sri Lanka, who bowled too many loose balls with the hosts hitting 59 fours to go with McCullum's solitary six.
The visitors, however, clawed their way back into the game after McCullum departed when he top-edged the third delivery of left-arm spinner Milinda Siriwardana's first over and was caught at deep square leg by Kithuruwan Vithanage.
Dushmantha Chameera then got rid of both Mitchell Santner (12) and BJ Watling (five) to check the scoring rate before Guptill and Tim Southee (two) fell to Mathews and Suranga Lakmal respectively. – Reuters
Original source: NZ trio punish SL bowlers