Tim Southee's wicket of Asad Shafiq (44) in the penultimate over of the day titled the scales in New Zealand's favour. Sarfraz Ahmed (28), the wicketkeeper, and Yasir Shah (1) were at the crease when stumps were drawn.
Ish Sodhi, the legspinner, had the prized scalp of Azhar (75) to finish with 2 for 65 after 30 overs of toil on a placid surface.
Pakistan, resuming at 34 for 2 saw off the first session without losing any wicket as Younis (72) and Azhar shared a 113-run stand for the third wicket.
But New Zealand nipped out four wickets over the course of the next two sessions to press home its claim of a sizable first-innings lead and in turn a chance to push for a series-levelling victory.
After Younis's dismissal, Azhar added 50 with Misbah-ul-Haq, the captain, before New Zealand hit back with the second new ball after 83 overs with Pakistan well placed at 194 for 3.
Trent Boult, the left-arm seamer, claimed his first wicket of the series by a brute that nipped off the seam to take the edge as Misbah was pouched by Ross Taylor at first slip for 28.
Azhar, however, continued to keep the bowlers at bay and entertain thoughts of an eighth Test ton. He drove Mark Craig past point to complete his 18th fifty, but chopped on a Sodhi delivery for 75 to end his vigil that lasted close to five and half hours.
Shafiq was lucky to survive on 26 when he was bowled by a superb inswinger from Boult, only to discover he had overstepped. But his resistance ended as he played a loose shot to break a 59-run stand for the sixth wicket with Sarfraz.
The morning session belonged to Younis, who hit seven fours and two sixes during his 160-ball knock, but fell to a casual shot, spoiling a good chance of scoring his 29th Test ton to draw level with Sir Don Bradman.