New Zealand skipper Ross Taylor (75), debutant Todd Astle (35) and Brendon McCullum (35) were the main scorers for New Zealand, while left-arm spinner Rangana Herath took three wickets for Sri Lanka.
The hosts were earlier bowled out for 244 in their first innings in reply to New Zealand's 412, with Thilan Samaraweera top-scoring with 76. Pacemen Tim Southee bagged five wickets and Trent Boult took four for New Zealand.
The hosts lead the series 1-0 following their 10-wicket win in the opening Test in Galle.
New Zealand 1st innings 412 (K. Williamson 135, R. Taylor 142, D. Flynn 53, R. Herath 6-103)
Sri Lanka 1st innings (overnight 225-6):
T. Paranavitana c van Wyk b Southee 40
T. Dilshan b Southee 5
K. Sangakkara c Boult b Southee 0
M. Jayawardene c Williamson b Boult 4
A. Mathews c Guptill b Southee 47
T. Samaraweera c Guptill b Boult 76
P. Jayawardene c Williamson b Patel 12
S. Randiv lbw b Boult 39
N. Kulasekara c Taylor b Southee 6
R. Herath c Williamson b Boult 5
S. Eranga not out 3
Extras (lb3, nb3, w1) 7
Total (94 overs) 244
Fall of wickets: 1-7 (Dilshan), 2-7 (Sangakkara), 3-12 (M. Jayawardene), 4-102 (Paranavitana), 5-103 (Mathews), 6-128 (P. Jayawardene), 7-225 (Samaraweera), 8-232 (Randiv), 9-240 (Kulasekara), 10-244 (Herath).
Bowling: Southee 22-4-62-5 (nb1), Boult 21-7-42-4 (nb2, w1), Patel 22-3-47-1, Astle 13-2-41-0, Bracewell 13-1-44-0, Williamson 3-1-5-0
New Zealand 2nd innings:
M. Guptill c Dilshan b Eranga 11
B. McCullum st P. Jayawardene b Herath 35
K. Williamson c Paranavitana b Kulasekara 18
R. Taylor run out 74
D. Flynn lbw b Kulasekara 0
K. van Wyk c Paranavitana b Herath 0
T. Astle c Dilshan b Randiv 35
D. Bracewell c Kulasekara b Herath 1
T. Southee not out 8
J. Patel st P. Jayawardene b Randiv 0
T. Boult not out 6
Extras (lb4, nb2) 6
Total (for nine wickets decl; 54 overs) 194
Fall of wickets: 1-32 (Guptill), 2-56 (McCullum), 3-74 (Williamson), 4-74 (Flynn), 5-75 (van Wyk), 6-172 (Astle), 7-177 (Bracewell), 8-180 (Taylor), 9-182 (Patel).
Bowling: Kulasekara 12-2-47-2, Eranga 10-1-39-1 (nb1), Herath 21-3-67-3, Randiv 11-1-37-2 (nb1)
Toss: New Zealand
Umpires: Marais Erasmus (RSA) and Nigel Llong (ENG)
TV umpire: Ruchira Palliyaguruge (SRI)
Match referee: Javagal Srinath (IND)
Spotted: Alia Bhatt, Ranveer Singh, Neha Dhupia in Bandra
Photos: Salman Khan returns from Jodhpur to Mumbai
15 'peach' perfect photos of Priyanka Chopra at People's Choice Awards 2017
62 going on 16: These photos of Rekha prove she is 'forever young'
Photos: Tennis legend Andre Agassi meets Rahul Dravid in Mumbai