Bangladesh, seeking their first win against a major Test playing country, were struggling at 49-4 in the second innings at lunch after left-arm spinner Hasan set Bangladesh's best innings figures with 7-36 to put them in command.
Opener Tamim Iqbal (30) and Mushfiqur Rahim (nought) were at the crease with the home team enjoying an overall 123-run lead.
The 21-year-old Hasan displayed quality spin bowling throughout his 25.5 overs to dismiss New Zealand for 171 in their first innings in reply to Bangladesh's 245.
Hasan's effort, which surpassed the previous best innings figures for Bangladesh in all their 54 Tests, gave the home team an invaluable lead in the first innings.
However, the home team's top order flopped again as opener Zunaed Siddique fell for six, caught off paceman Kyle Mills with just 24 runs on the board.
Rajin Saleh didn't last long, trapped leg-before by off-spinner Jeetan Patel for six before Daniel Vettori, who took 5-59 in the first innings, had Mohammad Ashraful smartly caught at cover by a diving Aaron Redmond for nought.
Patel also had first-innings hero Mehrab Hossain for six.
Earlier, Vettori (55 not out) scored his 17th Test half-century to help the tourists add a valuable 16 runs after they resumed at 155-9.
Vettori hit nine boundaries during his 73-ball knock.
It was Hasan again who dismissed the last man Iain O'Brien, bowled round his legs for five to dismiss New Zealand for their lowest total against Bangladesh.