Mahela Jayawardene's 91 helped Sri Lanka recover from 50-5 against New Zealand to 247 all out on day two in Galle.
The hosts, who began the day on 9-1, were chasing down New Zealand's first innings score of 221 and things started badly with two wickets falling inside the opening three overs.
Tim Southee bowled opener Tharanga Paranavitana and the seamer also collected the wicket of nightwatchman Suraj Randiv, who edged to second slip Martin Guptill.
The wickets kept on coming. Kumar Sangakara mustered just five runs while Thilan Samaraweera made 17 before being trapped lbw from the bowling of Southee to leave the hosts in trouble.
Sri Lanka avoided total collapse thanks to Jayawardene (91) and Angelo Mathews (79) who together scored 150 runs off 270 balls.
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 Trent Boult grabbing his second - and Sri Lanka's last - of the innings to finish with 2-46.
Patel's three wickets came at a cost of 55 but Southee's 4-46 was the best return by a New Zealand bowler as the home side were dismissed for 247.
New Zealand suffered another early blow in their second innings when they lost Brendon McCullum for 13.
The batsman, having hit Rangana 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-1, a lead of nine runs.