McCullum, however, was desperately unlucky to be given out by umpire Marais Erasmus after a thick inside edge onto the pad and made his displeasure known as he flung his bat in the air.
Taylor and Williamson set about resurrecting New Zealand's innings and did it intelligently and patiently. Taylor lived a little dangerously at times early, slashing one through slips when on 14 and then chopping another close to this stumps when 28, but looked progressively more comfortable.
He seemed intent on keeping the big shots to a minimum in a display of defiance and brought up his eighth test century, and third this year, off 189 balls.
Williamson was typically circumspect in his 229-ball vigil in hot and humid conditions but used his feet well on an easy-paced pitch that held few demons for the batsmen.
He's in sight of his third test century, which would be good reward for another responsible innings.
The pair rotated the strike well as they took advantage of a defensive field and, crucially, looked largely untroubled against spin.
Their unbeaten partnership of 209 was easily the best by a New Zealand pair this year, beating the 124 set by Guptill and McCullum against Zimbabwe in January, and only the fifth partnership of more than 100 in 2012. That in itself tells the story of the Black Caps' year.
Taylor and Williamson will still need to consolidate if New Zealand are to post a good first innings score considering they are playing only five specialist batsmen and Sri Lanka have a powerful batting lineup. They would do well to emulate former New Zealand captain Stephen Fleming, who amassed 274 not out on the same ground in 2003.
James Franklin paid the price for his lean run and was replaced in the side by leg spinner Todd Astle, who is making his test debut, and seemed to indicate the tour selectors have little faith in Rob Nicol who is the only other batsman in Sri Lanka.
It means wicketkeeper Kruger van Wyk is likely to bat at No 6, with Doug Bracewell or Astle, who was formerly an opening batsman before converting himself into a leg spinner, at seven.
New Zealand are looking to avoid a sixth-straight defeat which would equal the worst in this country's cricket history - that was set between January 1954 and October 1955 against South Africa, England and Pakistan.
It's still too early to believe they will escape defeat but they have at least given themselves a fighting chance.