New Zealand fast bowlers Tim Southee and Trent Boult ensured their side remained in charge of the second cricket Test against Sri Lanka on Monday, reducing the home side to 43 for three at the close.
New Zealand had reached 412 in their first innings thanks largely to a record third-wicket partnership of 262 between captain Ross Taylor (142) and Kane Williamson (135), before Southee took two for 16 and Boult one for 16.
At one stage Sri Lanka were 12 for three thanks to Boult and Southee's triple breakthrough before Tharanga Paranavitana (9) and Angelo Mathews survived (20) to the close without further loss.
Sri Lanka remain in a precarious position as Thilan Samaraweera may have problems batting after suffering a cut to the webbing on his right hand while fielding which required three stitches.
Southee started the rot with the first two wickets of the Sri Lanka innings in three balls, bowling the fit-again Tillakaratne Dilshan between bat and pad for five and then causing Kumar Sangakkara to top-edge a hook-shot to fine leg to perish for a duck.
"To get three wickets before stumps was a great start and the bowlers have been bowling really well throughout this series," Williamson said.
"It was a good day all round and finishing off with the wickets was great. I think we're in a good position but, saying that, it's a very good track and we've got to bowl that side out twice to get a victory.
"They have got some seriously good cricketers and so that's not going to be an easy feat (to win)."
Resuming at 223 for two, Taylor and Williamson took their stand to 262, a New Zealand record for all wickets in Sri Lanka, beating the unbroken 246 of Jeff Crowe and Richard Hadlee at the Colombo Cricket Club in 1987.
Williamson, who resumed on 95, moved to his third Test hundred in 253 balls with nine fours and also got to 1,000 runs in the longest form of the game, becoming the youngest New Zealand batsman to reach that mark at 22 years 110 days.
"It's been a tough tour with not having much time in the middle but I've been working really hard in the last week or so and so it's nice to have put together this innings," said Williamson.
The pair were eventually separated when Taylor, who started the day on 119, missed an attempted sweep at left-arm spinner Rangana Herath (6-103) after hitting 11 fours in an innings in which he faced 388 balls.
Williamson fell in similar fashion five overs later after just over seven hours at the crease, during which time he hit 12 fours.
With Kruger van Wyk (0) and debutant Todd Astle (3) following in quick succession either side of lunch, New Zealand were in danger of squandering the hard work of day one.
That they did not was due to Daniel Flynn who made 53, his second half-century of the series, and helped to steer New Zealand past 400 for only the second time in 10 Tests this year.
Flynn, like Williamson, also eased past 1,000 Test runs during his innings before he was dismissed by Herath, who claimed his third successive five-wicket haul in the series.
Herath now has 52 wickets in this calendar year, one behind the leading Test wicket-taker in 2012, England's Graeme Swann.
Scorecard:
New Zealand first innings
M. Guptill c Mathews b Kulasekara 4
B McCullum lbw Eranga 4
K Williamson lbw Herath 135
R Taylor lbw Herath 142
D Flynn lbw Herath 53
C van Wyk b Dilshan 0
T Astle lbw Herath 3
D Bracewell c Herath b Randiv 24
T Southee b Herath 15
J Patel not out 25
T Boult b Herath 1
Extras (b-2 lb-2 nb-2) 6
Total (all out, 153 overs) 412
Fall of wicket: 1-4, 2-14, 3-276, 4-290, 5-291, 6-300, 7-346, 8-347, 9-410.
Bowling: K Kulasekara 24-2-76-1 (2-nb), R Eranga 22-0-91-1, A Mathews 10-1-25-0, R Herath 29-10-103-6, S Randiv 39-3-94-1, T Dilshan 9-2-19-1
Sri Lanka first innings
N Paranavitana not out 9
T Dilshan b Southee 5
K Sangakkara c Boult b Southee 0
M Jayawardene c Williamson b Boult 4
A Mathews not out 20
Extras (lb-3, w-1, nb-1) 5
Total (3 wickets, 17 overs) 43
Fall of wicket: 1-7, 2-7, 3-12
Bowling: T Southee 6-2-16-2, T Boult 6-1-16-1 (1nb, 1w), J Patel 3-2-2-0, T Astle 2-0-6-0.
Photograph: Dinuka Liyanawatte/Reuters
Sri Lanka welcome back Dilshan for second Test
Boult praises Indian youngsters for patient batting
Blow to BJP as Nitish backs new CBI chief's appointment
'Team India favourites to lift Twenty20 World Cup'
Herath stars as SL crush NZ inside three days