New Zealand's spinners curtailed Pakistan's lead to 74 runs despite Azhar Ali and Asad Shafiq scoring centuries on Wednesday on the third day of the series-deciding third and final test.
Pakistan was cruising along at 286-3 on the back of double-century stand between Azhar (134) and Shafiq (104) before New Zealand came back strongly to bowl out the home team for 348 after tea.
Debutant Will Somerville (4-75) had to wait until his 22nd over for his first test wicket when Azhar top-edged the tall off-spinner and Ajaz Patel (2-100) dismissed Shafiq to trigger Pakistan's collapse.
However, openers Tom Latham (10) and Jeet Raval (0) yet again faltered as the visitors finished the day at 26-2 with New Zealand still trailing by 48 runs.
Leg-spinner Yasir Shah (1-5) had Latham caught in the deep and will be needing only one wicket on Thursday to become the fastest bowler in test history to complete 200 test wickets.
Incidentally, Pakistan got the same first innings lead in the first test at the same venue before losing narrowly by four runs. Pakistan levelled the series at 1-1 with a resounding innings and 16-run victory in the second test in Dubai.
Earlier, resuming on 139-3, Pakistan had a productive first session. Azhar, the dependable No. 3 batsman, square cut Trent Boult (2-66) over backward point for a boundary off the very first ball of the day and completed his century within the first hour.
New Zealand couldn't get the breakthrough even after bowling 10 overs with the second new ball before lunch.
Both New Zealand spinners couldn't get enough help off the wicket in the first session. That was in sharp contrast to the effort of Pakistan spinners Bilal Asif and Shah, who bagged eight wickets between them in New Zealand's first innings score of 274.
Azhar, 62 overnight, completed his flawless century, off 210 balls, with an edgy boundary through third man off Colin de Grandhomme. Shafiq then reached his 50 off 142 balls when he reverse swept Patel for two runs as Pakistan added 85 runs in the first session.
Azhar's 15th test hundred and the first against New Zealand included 12 boundaries and came off 297 balls before he played a rare false shot against Somerville.
Shafiq completed his century with a single off Somerville but fell leg before wicket off Patel in the next over. Shafiq's 12th test century off 259 balls included 14 fours as he used his feet well against the spinners and played some delightful cut shots against seamers.
New Zealand came back strongly in the last session with Babar Azam (14) played onto Somerville immediately after the break. Ross Taylor took a sharp reflex catch to dimiss Bilal Asif (11).
Shah was run out in bizarre fashion when he lost his right shoe while going for the second run with captain Sarfraz Ahmed (25). Somerville then wrapped up the innings quickly by claiming the last two wickets to limit Pakistan's lead.