An unbeaten half-century from Kane Williamson has carried New Zealand to within sight of victory against Sri Lanka in a topsy-turvy second cricket Test in Hamilton.
The Black Caps, chasing 189, head into day four needing 47 more runs with five wickets in hand to complete a 2-0 series win.
New Zealand were 5-142 at stumps on Sunday, with Williamson on 78, having produced some typically stylish strokes despite hobbling at times.
After New Zealand had been stuttering at 2-11, he and Ross Taylor put on 67 before Taylor became the latest batsman in the match to perish to a hook shot.
On 35, Taylor fell to Sri Lanka's most successful bowler, Dushmantha Chameera, when substitute fieldsman Jeffrey Vandersay completed an acrobatic catch on the boundary.
Williamson also put on a half-century stand with skipper Brendon McCullum, who largely curbed his aggressive instincts early on.
But with 59 needed, McCullum charged Chameera, got a top edge and was caught for 18.
Chameera ended the day with 4-45, having taken his maiden Test bag of five in the first innings.
Sri Lanka had one further success late on, Suranga Lakmal dismissing Mitchell Santner for the day's 16th wicket.
It was Chameera who produced the early double strike to give the tourists hope after they had collapsed from 0-71 to 133 all out in their second innings.
In a Test in which the short ball has been a profitable tactic, Tom Latham (4) was caught at fine leg after hooking, while Martin Guptill (1) fended off a delivery to leg gully.
Earlier on Sunday, Sri Lanka wasted little time in taking the last wicket remaining to close out the New Zealand first innings for 237.
Leading by 55, they then looked to setting a solid target as Dimuth Karunaratne and Kusal Mendis put on 71, Sri Lanka's best opening stand in 12 months.
But Karunaratne's dismissal for 27 precipitated a spectacular collapse.
Doug Bracewell effected the initial breakthrough and followed up by dismissing Udara Jayasundera for a duck two balls later.
When fellow seamer Neil Wagner chimed in by getting rid of Dinesh Chandimal for four, the tourists had lost three wickets for six runs just out from lunch.
Sri Lanka then lasted less than an hour after the break, all 10 wickets going for 62 runs and in the space of 14 overs.
The 20-year-old Mendis, in his third Test, top-scored with 46 before being caught in the deep while hooking a Tim Southee delivery.
Southee finished with 4-26 to take his career wicket tally to 163 and move into fifth place above Danny Morrison on the list of New Zealand Test bowlers.
The only other batsman to reach double figures was Milinda Siriwardana who showed plenty of aggression in getting to 26, smacking a four and two sixes in one Wagner over.
After conceding another boundary, Wagner had Siriwardana holing out at deep mid-wicket and went on to end with 3-40.