Left-arm spinner Taijul Islam claimed 4-40 to rip through New Zealand's batting lineup as Bangladesh closed in on a victory in the series-opening test on Friday.
New Zealand was reduced to 113-7 at stumps on day 4, chasing a victory target of 332.
Daryl Mitchell batted patiently to end the day on 44, with Ish Sodhi on 7. Opener Devon Conway was the only other batter to put up resistance with 22.
"We need this victory badly because when you will beat a big team like New Zealand, it will give you the confidence," Taijul said. "We won't say we've won the game until we grab the last wicket."
Sylhet Test: Quick wickets daunt New Zealand’s chase for 332
Pacer Shoriful Islam extended Tom Latham's lean patch with a six-ball duck in the first over, and Kane Williamson failed to build on his first-innings century on an increasingly deteriorating wicket. Williamson started with a brace of boundaries against Mehidy Hasan but Taijul troubled him by varying the pace and finally trapped him lbw for 11. Williamson reviewed in vain.
Henry Nicholls was the next to go, top-edging a slog-sweep off Mehidy to Nayeem Hasan at short fine leg for 2.
Conway was playing with positive intent with wickets falling around him and perfectly swept the spinners to keep the scoreboard moving before Taijul had him caught by Shahadat Hossain at short leg.
With New Zealand at 46-4, the onus was on Mitchell but he found little support from the other end.
Wicketkeeper-batter Tom Blundell (6) was stifled by Taijul before edging a turning delivery behind, and Nayeem pegged back the visitors further with a successful review to remove Glenn Phillips.
Sylhet Test: Bangladesh set 332-run target for New Zealand
When Taijul got the better of Kyle Jamieson for 7, Bangladesh looked like they could wrap up the win on day four.
But Mitchell and Sodhi survived a tricky 30 minutes before the bad light forced stumps.
"It's not a bad wicket. I suppose their bowlers have bowled very disciplined and put the ball in good areas and asked us good questions for long periods of time," New Zealand spinner Ajaz Patel said. "A lot of batting to do tomorrow. We've got Dazzler (Mitchell) there who's batted quite nicely today. And we know how capable Ish (Sodhi) is with the bat as well. I think we pride ourselves to fight all the way through. So, it'll be an interesting day tomorrow."
Earlier, Bangladesh was bowled out for 338 in its second innings. Najmul Hossain Shanto added just one run to his overnight score and was out for 105 as Bangladesh lost a succession of wickets.
Mehidy Hasan scored 50 not out to help the side take the lead past 300.
The hosts started Day 4 on 212-3 but lost Shanto in the second over when Tim Southee had him caught down the leg side, ending a 98-run fourth-wicket stand.
Bangladesh's ODI, T20 Squads for tour of New Zealand announced
Mushfiqur Rahim continued and raised his 27th test half-century off 79 balls, with an outside-edge two against Southee. But he failed to convert it to a hundred when left-arm spinner Ajaz Patel trapped him in front for 67.
Legspinner Ish Sodhi got the better of Shahadat Hossain (18) to expose Bangladesh's lower order, which failed to play around Mehidy.
Bangladesh lost the last three wickets for 27 runs but that was enough to set a tough target for New Zealand.
The home side was dismissed for 310 in its first innings and conceded 7-run lead when New Zealand put up 317 all out.