You are not permitted to download, save or email this image. Visit image gallery to purchase the image.
Centuries by Azhar Ali and Asad Shafiq helped Pakistan overhaul the Black Caps' total of 274, but a lower-order collapse saw their lead restricted to 74 on day three of the third test in Abu Dhabi.
Sarfraz Ahmed's side nevertheless regained control of the match in the final test by picking up two quick wickets to leave New Zealand in trouble at 26-2 in 14 overs at close of play on Wednesday.
Kane Williamson, who scored a fighting 89 in the first innings, was batting on 14 with nightwatchman William Somerville for company on one with the Kiwis trailing by 48.
Pakistan, who resumed on their overnight score of 139-3, rode on Azhar's 134 and Shafiq's 104 to get into a commanding position in the series decider at the Sheikh Zayed Stadium.
The pair's 201-run partnership for the fourth wicket ended when Azhar became off-spinner Somerville's first test victim.
The 33-year-old batsman mistimed a sweep to offer Ajaz Patel a catch at short fine leg and leave Pakistan at 286-4.
Shafiq perished shortly afterwards after failing to read left-armer Patel's arm ball and was adjudged leg before with a review confirming the dismissal.
His wicket triggered a Pakistan collapse as they went from 304-5 to 348 all out, with Somerville ripping up the tail after tea to finish with figures of 4-75.
Shah, who has four wickets in the match, needs one more to replace Australian Clarrie Grimmett as the fastest man to claim 200 test victims. Leg-spinner Grimmett reached the 200 mark in his 36th test back in 1936. Shah is on 199 in just his 33rd test match.
New Zealand won the opening test in Abu Dhabi by four runs before Pakistan squared the three-match series with victory in the second test in Dubai by an innings and 16 runs.