The 32-year-old leggie, who took 8-41 in the first innings, had figures of 6-143 in the second innings for a match haul of 14-184.
New Zealand – following-on after being dismissed for 90 in the first innings – were bundled out for 312 on the fourth day as Pakistan gained a measure of revenge for losing the first Test by four runs in Abu Dhabi last week.
"I came to know yesterday (about Imran Khan's record) so it's an honour that my name will come with him," said Yasir.
"I haven't bowled as well as this, especially with the pitch offering turn and bounce like it did. We wanted to put the disappointment of the first Test behind us and set up the series."
Yasir's figures are the second best match return ever for Pakistan in Test cricket, bettered only by former captain Imran Khan who took 14-116 against Sri Lanka in Lahore in 1982.
They are also the best by a Pakistani bowler against New Zealand, beating Waqar Younis's 12-130 in Faisalabad in 1990.
Hasan Ali was also at his best, taking 3-46.
Resuming on 131-2 and needing a further 197 to make Pakistan bat again, the New Zealand batsmen, led by Ross Taylor (82), Henry Nicholls (77) and Tom Latham (50), dug in.
Taylor smashed his 29th half century in Tests, while Latham completed his 15th Test fifty but was dismissed the following ball, a little edge behind off Hasan, television umpire Ian Gould confirming that Sarfraz Ahmed had taken the catch cleanly.
Nicholls added 52 runs with Taylor and BJ Watling for the fourth and fifth wicket partnerships to frustrate Pakistan bowlers.
Taylor, who tried to attack the bowlers early on, grew impatient after being tied down and which eventually resulted in his wicket. An attempted sweep off Bilal Asif ended in a top edge that looped to deep backward square leg where Yasir took an easy catch running in about five yards.
Yasir trapped Watling leg before for 27 to end another frustrating stand and get into the Kiwi tail. De Grandhomme made just 14 and was accounted for by Hasan Ali, and Sodhi was bowled behind his legs for four, unwisely trying to sweep Yasir from well outside off-stump.
Nicholls stood firm amid the wreckage, before Yasir nipped one between bat and pad to bowl him for 77.
Skipper Kane Williamson later admitted the damage had been done in the first innings when New Zealand lost all 10 wickets for just 40 runs in 14 overs.
"We batted better in the second innings," said Williamson. "But that session yesterday, Yasir put us under tremendous pressure and put the ball in the right areas and got us for 90. That low first innings total was always a factor."
The end came swiftly as Yasir picked up the last two wickets in the space of four balls.
The two teams return to Abu Dhabi for the final Test starting on 3 December.