Anderson, 22, playing only his second Test, put on 140 runs with Kane Williamson for the fifth wicket to help New Zealand recover from 127-4 to reach 419-8 at stumps on the third day, with a 137 lead over the hosts.
B.J. Watling chipped in with an unbeaten 59 alongside Ish Sodhi who was 55 not out, as the pair shared an unbroken 84-run stand, adding to Bangladesh's frustration in Dhaka.
His feat came only after the visitors had overtaken Bangladesh's first innings total of 282.
The Black Caps' lead was largely due to a sparkling innings by Anderson, who slammed 116 off 173 balls before he became the first Test wicket of debutant Al-Amin Hossain, caught at extra cover by Sohag Gazi.
Also Read
Williamson fell after he mistimed a lofted shot off left-arm spinner Abdur Razzak and was caught by Tamim Iqbal at deep midwicket for 62.
Anderson and Williamson turned the game decisively in the visitors' favour after Shakib had removed star batsman Ross Taylor in the morning session for his fourth wicket in the innings.
The Black Caps had resumed the day's play on 107-3 and batted cautiously until Anderson and Williamson opened up to put the pressure back on the bowlers.
Anderson gloved the second ball he faced but it dropped inches short of wicketkeeper Mushfiqur Rahim.
Anderson cashed in on his good fortune, with his half-century coming off only 72 balls.