The 32-year-old Shah took seven wickets in his 2014 debut Test against Australia in Dubai.
The 32-year-old trapped nightwatchman Will Somerville leg before for four - his second wicket of New Zealand´s second innings - to reach the milestone in his 33rd Test, beating Australian leg-spinner Clarrie Grimmett's record of 36 Tests set against South Africa in Johannesburg in 1936.
That gave New Zealand a lead of 125 with six wickets intact and an outside chance of forcing a win in the series now tied at 1-1. But Williamson and Nicholls defied the bowling during their unbroken 139-run stand for the fifth wicket.
New Zealand skipper Kane Williamson, who scored a fighting 89 in the first innings, was batting on 14 with night-watchman William Somerville on one with the visitors trailing by 48.
Nicholls survived a loud leg-before appeal off Yasir when on three, but Pakistan erred by not reviewing the not-out decision as the ball tracker showed it would have hit the leg stump.
New Zealand could not capitalise as opener Jeet Raval was dismissed for a duck by left-arm paceman Shaheen Shah Afridi before leg-spinner Yasir Shah sent back Tom Latham for 10.
New Zealand, resuming at 26 for 2 on Thursday, fell to 37 for 3 after Yasir removed Somerville and were still needing 37 runs to make Pakistan bat again.
His 14 for 184 were the second best match figures in a Test for Pakistan, behind former captain and current prime minister of Pakistan Imran Khan, who bagged 14 for 116 against Sri Lanka in Lahore in 1982.
Shah also equaled Pakistan's record of most wickets in a test match by claiming 14 wickets in the second test against New Zealand last week. Yasir Shah notched up figures of 8 for 41 in the first innings and 2 for 65 in the second innings (follow-on) on Day three of the second Test.
Pakistan legspinner Yasir Shah has become the quickest bowler to take 200 wickets in Test history.