The visitors reached 87-2 at stumps after Thilan Samaraweera top-scored with 159 to take Sri Lanka to a first innings score of 452.
New Zealand opener Tim McIntosh was unbeaten on 36 in a patient 88-ball innings batting with night watchman Jeetan Patel on six.
Martin Guptill (24) was the first Kiwi batsman to be dismissed as he played a ball from seamer Thilan Thushara onto his stumps. Daniel Flynn (14) was bowled by spinner Ajantha Mendis approaching stumps.
The late wicket took some of the gloss off the Black Caps' performance on day two, which began with Sri Lanka in command at 293-3.
New Zealand captain Daniel Vettori, whose four wickets contributed towards his team's resurgence, said he was pleased with side's fighting spirit.
"I think from where we were yesterday the big thing that we wanted was to show some fight today to put ourself in the position that we have.
"I couldn't really have asked too much more, particularly from the bowling performances. So a pleasing day," Vettori said, adding it was now down to his batsmen to build a good total.
Mahela Jayawardene (114) added just six runs to his overnight score before being caught at slip by Ross Taylor off seam bowler Iain O'Brien in a rain-shortened first session. He hit 15 boundaries in a 227-ball innings and was involved in a 166-run partnership for the fourth wicket with Samaraweera.
Jayawardene made it clear that his dismissal had been a setback.
"We had a plan to bat at least till lunch...but unfortunately it was a bad shot, loss of concentration as well. Disappointed, definitely," Jayawardene said.
"Getting 500 or 550 would have been ideal, but I think from where we are right now we are satisfied with 450 and two wickets this afternoon. Hopefully we can strike early tomorrow."
Seamer Chris Martin (4-77) and Vettori (4-78) played key roles in preventing the hosts recording the giant score they threatened when there were only four wickets down and the score approaching 400.
Samaraweera patiently reached his 10th test hundred off 223 balls and more than 4½ hours at the crease. After reaching three figures, he cut loose with 59 runs in 54 balls before being caught by Patel off Vettori.
This was his third time passing 150 runs, with the two previous resulting in double hundreds. Samaraweera's innings included 24 boundaries and a six.
Sri Lanka's last six wickets fell for just 66 runs.
Heavy morning showers at Galle International Stadium meant just one hour of play was possible in the first session.
Scoreboard
Sri Lanka 1st Innings
(Overnight 293 for three)
Tharanga Paranavitana c McCullum b Martin 0
Tillakaratne Dilshan b O'Brien 92
Kumar Sangakkara c Flynn b Martin 8
Mahela Jayawardene c Taylor b O'Brien 114
Thilan Samaraweera c Patel b Vettori 159
Angelo Mathews c McCullum b Vettori 39
Prasanna Jayawardene c Flynn b Vettori 7
Nuwan Kulasekara c McCullum b Martin 18
Thilan Thushara c O'Brien b Vettori 0
Muttiah Muralitharan c McCullum b Martin 8
Ajantha Mendis not out 0
Extras: (1b, 2lb, 2nb, 2w) 7
TOTAL: (all out) 452.
Overs: 117.4. Batting time: 468 minutes.
Fall of wickets: 1-0, 2-16, 3-134, 4-300, 5-386, 6-408, 7-444, 8-444, 9-452, 10-452.
Bowling: Chris Martin 23-5-77-4, Iain O'Brien 21-1-125-2 (2nb,1w), Jacob Oram 7-1-25-0, Daniel Vettori 37.4-9-78-4, Jeetan Patel 24-3-120-0, Jesse Ryder 5-1-24-0 (1w).
New Zealand 1st Innings
Tim McIntosh not out 36
Martin Guptill b Thushara 24
Daniel Flynn b Mendis 14
Jeetan Patel not out 6
Extras: (4b, 3nb) 7
TOTAL: (for two wickets) 87.
Overs: 29. Batting time: 118 minutes.
Fall of wickets: 1-45, 2-80.
Still to bat: Daniel Vettori, Brendon McCullum, Ross Taylor, Jesse Ryder, Jacob Oram, Iain O'Brien, Chris Martin.
Bowling: Nuwan Kulasekera 4-0-21-0, Thilan Thushara 8-1-29-1 (3nb), Ajantha Mendis 11-3-26-1, Muttiah Muralitharan 6-2-7-0.
Umpires: Daryl Harper, Australia, and Nigel Llong, England.