New Zealand's bowlers struck back on the second day of the first Test in Galle to get themselves back on an even keel against Sri Lanka.
Having been skittled for 221 on Saturday the Black Caps enjoyed a topsy-turvy day as, having reduced their hosts to 50 for five, a sixth-wicket stand of 156 appeared to have put the hosts in control.
However, the tourists hit back taking the last five wickets for 41 to trail by only 26 on first innings and by stumps they had moved nine ahead.
Tim Southee claimed three early wickets, with Trent Boult taking the other, to leave Sri Lanka, who resumed on seven for one, teetering.
They avoided total collapse thanks to Mahela Jayawardene (91) and Angelo Mathews (79) who together scored 150 runs off 270 balls to seemingly take the game away from New Zealand.
But just six runs later the dismissal of Mathews in the 65th over - caught behind off James Franklin - sparked a domino effect which Sri Lanka could not halt.
Off-spinner Jeetan Patel came into his own with three wickets, including the vital one of Jayawardene, with Boult grabbing his second - and Sri Lanka's last - of the innings to finish with two for 46.
Patel's three wickets came at a cost of 55 but Southee's four for 46 was the best return by a New Zealand bowler.
The only other Sri Lankans to reach double figures apart from the two half-century makers were Thilan Samaraweera (17) and tailender Rangana Herath (11 not out) as the home side were dismissed for 247.
New Zealand suffered another early blow in their second innings when they lost Brendon McCullum for just 13.
The batsman, having hit Herath for a six two balls earlier, launched into a short delivery but his pull behind square lacked the necessary distance and Nuwan Kulasekara claimed the catch out in the deep.
Martin Guptill (13no) and Kane Williamson (nine not out) ensured there were no further slip-ups as New Zealand closed on 35 for one.