Tim Southee and Doug Bracewell rocked Sri Lanka with two wickets apiece to boost New Zealand's chances of posting a series-levelling win in the second and final Test on Wednesday.
The hosts, needing 363 to win, were struggling at 47-4 in their second innings at stumps on the penultimate day when 17 wickets fell at the P. Sara Oval in Colombo.
Fast bowler Southee, who took five wickets in the first innings, continued to trouble the Sri Lankan batsmen as he removed openers Tharanga Paranavitana and Tillakaratne Dilshan in his lively opening spell.
Paceman Bracewell then grabbed two big wickets when he bowled Kumar Sangakkara (16) and had skipper Mahela Jayawardene (five) caught behind.
New Zealand skipper Ross Taylor, who scored a hundred in the first innings, top-scored with 74 after his team had lost three wickets for one run off four balls.
New Zealand, leading by 168 runs, declared their second innings at 194-9 to set a challenging target for the hosts, who lead the series 1-0 following their 10-wicket win in the opening Test.
The tourists slipped from 74-2 to 75-5 before Taylor and debutant Todd Astle (35) steadied the innings with a 97-run stand for the sixth wicket.
Paceman Nuwan Kulasekara had Kane Williamson (18) caught by Paranavitana in the slips and then trapped Daniel Flynn leg-before with the last two balls of his eighth over.
Left-arm spinner Rangana Herath then struck with the second delivery of the next over, having Kruger van Wyk caught by Paranavitana at leg-slip for a duck.
Taylor played a responsible knock and reached his half-century with just one four when he fluently drove off-spinner Suraj Randiv through the covers, while Astle provided valuable support.
Astle was unlucky to be caught after the tea-break as his attempted sweep off Randiv hit the boot of a close-in fielder before going to Dilshan at short mid-wicket.
Southee earlier finished with 5-62 for his third five-wicket haul in a Test innings and left-arm paceman Trent Boult with 4-42 as Sri Lanka were bowled out for 244 in their first innings in reply to New Zealand's 412.
New Zealand needed just 7.4 overs of pace in the morning to claim the last four wickets for 19 after the hosts had resumed at 225-6, with Boult taking three and Southee one.
Thilan Samaraweera fell at his overnight score of 76 while Randiv (39) made just five in the morning. The pair added 97 for the seventh wicket.Scoreboard