Tom Latham celebrates his century as teammate Henry Nicholls looks on during day three of the second Test.
A year ago the middle-order batsman was struggling to hold his place in the side.
But a personal best 162 not out, and a 214-run partnership with Tom Latham (176) were key to New Zealand having Sri Lanka on the ropes at the end of the third day.
New Zealand declared their second innings at 585 for four, to lead by 659 runs and at stumps Sri Lanka in their second innings were two for 24.
"I was really lucky. I learned a lot early in my career through a lot of failure," said Nicholls after his third century this year.
It has lifted his average to a respectable 43.15 in his 22nd Test. It was under 25 after his first 10 innings.
"I consider myself really grateful, the selectors and everyone in the team had a lot of confidence and faith in me that I'd use those experiences to make me a better player," he said.
And it was as the better player that he and Latham, and later Colin de Grandhomme (71 not out), combined to effect a plan to tire the Sri Lankans in the field.
"That's what we tried to do in terms of keeping them out for so long, especially in that last period, running them around as much as we could," the 27-year-old said.
"Then having that little burst later in the day, picking up a couple of big wickets was probably the ideal script for us."
Play resumes on the fourth day Saturday with Dinesh Chandimal on 14, Kusal Menis on six and Sri Lanka needing another 636 runs with eight wickets remaining.
Only three times in cricket history has the winning side scored more than 400 in the fourth innings, with the current record of 418 set by the West Indies against Australia 15 years ago in Antigua.
The highest fourth innings score in the modern era is New Zealand's 451 chasing 550 against England in 2002, while England scored 654 for five after being set a target of 696 by South Africa in 1939.
Unlike the first Test in Wellington, where rain washed out most of the final day, fine weather is forecast for the remainder of the Christchurch Test.Kiwis on top
New Zealand first innings 178 (T. Southee 68, B. Watling 46; Lakmal 5-54)
Sri Lanka first innings 104 (A. Mathews 33no; Boult 6-30, Southee 3-35)
New Zealand second innings (overnight 231-2)
J. Raval c Mendis b Perera 74
T. Latham c Dickwella b Chameera 176
K. Williamson c Mendis b Kumara 48
R. Taylor lbw Kumara 40
H . Nicholls not out 162
C. de Grandhomme not out 71
Extras: (b 5, lb 3, wd 3, nb 3) 14
Total: (for 4 wkts dec; 153 overs) 585
Fall: 1-121, 2-189, 3-247, 4-461
Bowling: Lakmal 30-6-96-0, Kumara 32-6-134-2 (1w), Chameera 30-5-147-1 (2w, 2nb), Perera 41-3-149-1 (1nb), Gunathilaka 16-2-45-0, Karunaratne 4-2-6-0
Sri Lanka second innings
D. Gunathilaka c Watling b Southee 4
D. Karunaratne c Watling b Boult 0
D. Chandimal not out 14
K. Mendis not out 6
Extras: 0
Total: (for 2 wickets; 14 overs) 24
Fall: 1-1, 2-9
Bowling: Boult 7-3-11-1, Southee 7-5-13-1
Toss: Sri Lanka
Umpires: Richard Illingworth (ENG), Michael Gough (ENG)
TV umpire: Rod Tucker (AUS)
Match referee: Richie Richardson (WIS)