The right-hander was unbeaten on 72 and Younis Khan was 26 not out as Pakistan reached 127-1 in their second innings at lunch on the fourth morning, leading by 431 with nine wickets intact.
Pakistan, playing their home series in the United Arab Emirates because of concerns over extremist attacks, are in an ideal position to force a 1-0 lead in the three-match series.
Younis, who hit a brilliant 100 not out in the first innings, survived a leg-before decision on the last ball before lunch, bowled by leg-spinner Ish Sodhi.
Hafeez opened up after a cautious start, hitting boundaries off paceman Trent Boult and then hit two off Sodhi to complete his fifty and follow up his 96 in Pakistan's first innings of 566-3 declared.
More From This Section
He has so far hit 10 fours and a six off 110 balls.
Pakistan, resuming at 15-0, had looked for quick runs but were checked by disciplined New Zealand bowling.
Sodhi removed Azhar Ali for 23 to give his team the early breakthrough. He has figures of 1-47.