The Black Caps have set Sri Lanka a target of 268 to win the first test in Galle, anchored by BJ Watling's gutsy 77 and a gritty unbeaten 40 from Will Somerville.
The Black Caps, having conceded an 18-run first innings lead, were reeling at 25 for three on the third day but battled back to be all out for 285 just before lunch on day four.
Tom Latham's earlier 45 was crucial after Jeet Raval (four), Kane Williamson (four) and Ross Taylor (three) all fell cheaply.
The Black Caps resumed at 195-7 today, with Watling proving an invaluable anchor as he grafted 77 off 173 balls.
Will Somerville was unbeaten on 40 as the New Zealanders added 107 runs for their final three wickets.
Trent Boult contributed an entertaining 26 off 25 balls, while Ajaz Patel - who grabbed 5-89 in Sri Lanka's first innings 267 - made 14 before he was trapped lbw by Dhananjaya de Silva.