New Zealand made 285 all out to leave the hosts with a tricky fourth-innings target.
Sri Lanka got off to a strong start in their chase for a 268-run victory target after skipper Dimuth Karunaratne and Lahiru Thirimanne frustrated New Zealand with a 133-run opening stand on the penultimate day of the opening test on Saturday.
After New Zealand made 285 all out to leave the hosts with a tricky fourth-innings target, Karunaratne and Thirimanne batted sensibly through the last two sessions to swing momentum their way.
Karunaratne hit only two boundaries in his patient 71, while Thirimanne stroked four of them in his sedate 57 before bad light stopped play with the hosts needing 135 to go 1-0 up in the two-test series.
The home captain needed luck to reach the 50-mark, which he did when BJ Watling, who had an outstanding match with the bat, could not hold on to a catch after Karunaratne had edged spinner William Somerville.
Earlier, Watling and Somerville batted resolutely to frustrate Sri Lanka after New Zealand resumed on 195-7 at the Galle International Stadium.
Watling, who had completed his fifty on Friday, fell for 77 which is the highest test score by a New Zealand wicketkeeper in Sri Lanka.
Trent Boult chipped in with 26 useful runs while Somerville remained not out on 40 after facing 118 balls.
For the hosts, spinners Lasith Embuldeniya (4-99) and Dhananjaya de Silva (3-25) shared seven wickets between them.