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-run lead over the hosts.
B.J. Watling chipped in with an unbeaten 59 alongside Ish Sodhi who was 55 not out, as the pair added to the hosts' frustration with an unbroken 84-run stand. Shakib, the only Bangladeshi bowler to impress, had Doug Bracewell caught by Mushfiqur Rahim for his 10th five-wicket haul shortly before the tea break.
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.
"It is obviously a good feeling to score a hundred for your country," Anderson told reporters. "It took me a lot longer in first-class cricket, but I guess I have learned my trade. "To get it this early is a satisfying feeling." 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 had turned the game decisively in the visitors' favour after Shakib removed star batsman Ross Taylor in the morning session for his fourth wicket in the innings. Former skipper Taylor, playing his 50th Test, smacked five boundaries in his innings of 53 after New Zealand lost their openers cheaply on the rain-hit second day.
New Zealand 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. Despite the visitors' dominance Bangladesh have yet to abandon hope of a win or a draw in the Dhaka match.
"We have two days left, but because this is Test cricket, there are changes in the tone of the game," said batsman Nasir Hossain. "We have a chance to save or win this game. We are disappointed because we fell short by 100 runs in the first innings. "We hope it won't be repeated in the second innings."