The tourists lost six wickets in the final session at Hagley Oval to be 129-7 at stumps, ahead by only 62 runs with two days remaining.
Boult had three for 18 off 15 overs while Wagner, who started the wicket spree, had two for 21.
Not out for Pakistan were Sohail Khan on 22 and Asad Shafiq on six with the Test likely to be all over in three playing days after the scheduled first day was washed out.
Until Wagner struck, Pakistan were clawing their way back into the Test having started the day on the back foot.
They ripped out the last seven New Zealand wickets for only 96 runs and Azhar Ali and Babar Azam were painstakingly building their second innings – accumulating 37 runs in 23 overs.
But, in the sixth over after tea Azam on 29 attempted to fend away a Wagner ball targeting his ribs only for it to skim the gloves and wicketkeeper BJ Watling completed the dismissal.
It gave Wagner his 100th scalp in his 26th Test, making him the second-fastest New Zealander to claim a century of wickets after Richard Hadlee reached the mark in 25 matches.
Younis Khan lasted only eight balls before he gloved a Wagner bouncer to Watling and Pakistan had gone from 58-1 to 64-3 and were still three runs in deficit and the rot had started.
Captain Misbah-ul-Haq tried to knock Tim Southee out of the attack with a four and two off successive balls but he pulled the next delivery to Boult running around the long-leg boundary and he was gone for 13.
An inspired Boult then bowled Azhar to end the opener’s marathon innings in which he faced 173 balls in more than four hours for only 31 runs.
Boult, on a roll, bowled Sarfraz Ahmed for two and had Mohammad Amir caught for six.
Until the late collapse Pakistan had been all concentration with only 44 runs scored in the middle session to be 50 for one at tea,
Colin de Grandhomme, whose first innings 6-41 was the best bowling performance by a New Zealander on debut, made the opening breakthrough in Pakistan’s second innings when he had Sami Aslam, who faced 57 deliveries, out for seven.
After New Zealand resumed the day in a commanding position at 104-3, some impetuous shot-making saw them all out for 200 as they tried to hurry the score along under cloudy skies and a pitch that suited seam bowlers.
Overnight batsmen Jeet Raval and Henry Nicholls were gone in the first four overs with Raval unable to add to his overnight 55 and Nicholls adding only one run to be gone for 30.
De Grandhomme, who has rarely been out of the spotlight in his maiden Test, belted a quickfire 29 that included six boundaries while Southee (22) and Wagner (21) also plundered quick runs in their brief cameos.
The New Zealand innings folded in 55.5 overs, just four more than Pakistan’s first innings of 133.
Rahat Ali was the chief destroyer for Pakistan with four for 62 while Sohail Khan and Mohammad Amir took three wickets each.