The big-hitting Anderson made 116 and put on 140 with Kane Williamson, who made 62 having retired hurt at one stage on Tuesday.
Ross Taylor earlier reached 53 before becoming Shakib Al Hasan's fourth victim and the spinner took his fifth wicket, that of Doug Bracewell, to bring about the tea break with the Black Caps 318 for seven.
Taylor took three runs from the first ball of the day as six came from the remainder of Rubel Hossain's unfinished over.
A boundary off Shakib took the former skipper to 50 but he perished two balls later after edging to Nasir Hossain.
Anderson, who failed twice on debut in the drawn first Test in Chittagong, played himself in responsibly with just three runs from his first 30 balls but soon drove Sohag Gazi for two boundaries and swept Shakib for another.
A six off Shakib took him into the 40s and he squirted the same bowler to fine leg to reach a two-paced, 71-ball half-century.
Williamson followed him to the landmark in a more pedestrian 105 deliveries by on-driving Al-Amin Hossain for his fifth four as lunch was taken at 231 for four.
Anderson hoisted Abdur Razzak beyond the mid-wicket fence and brought up the century stand with a four and a single off the first two balls of a new spell from Rubel.
And his personal total reached three figures when he turned his 139th ball, from Gazi, to the mid-wicket rope.
Williamson was dropped by Mushfiqur Rahim but his dogged knock finally ended, after 151 balls and six fours, when he skied Razzak to Tamim Iqbal at deep mid-wicket.
Al-Amin took the key wicket, his first in Tests, in his second over with the new ball when Anderson drove to Gazi at extra cover. He hit 13 fours and two sixes in 173 balls.
BJ Watling (23 not out) hooked Al-Amin for four to bring up the 300 and put on 31 with Bracewell (17) before the latter edged Shakib to keeper Mushfiqur.