Devendra Bishoo's Test career-best bowling figures of 8-49 gave the West Indies a chance of beating Pakistan in the day-night Test in Dubai.
The spinner claimed best-ever away figures for a West Indian, as Pakistan fell for 123 in their second innings.
Yasir Shah earlier took 5-121 to dismiss the visitors for 357, becoming the joint-second fastest player to take 100 Test wickets.
West Indies closed on 95-2, requiring another 251 runs to win.
Yasir reached his milestone in just his 17th Test, after picking a seventh career five-wicket haul as he mopped up the West Indies' tail.
The 30-year-old joins Australian pair Charlie Turner and Clarrie Grimmett and England's Sydney Barnes, and was one Test slower than another Englishman, George Lohmann.
Bishoo heroics highlight Pakistan's complacency
Having earned a 222-run first-innings lead, Pakistan were soon on the back foot as legspinner Bishoo, who was introduced in the seventh over, trapped Asad Shafiq lbw with his fourth ball.
Sami Aslam and Babar Azam's 57-run third wicket stand looked to have steadied the ship but when the latter chopped on to his stumps, the hosts crumbled.
Pakistan lost 8-46 as Guyana-born Bishoo bowled captain Misbah-ul-Haq via an inside edge, Mohammad Nawaz left a straight ball and wicketkeeper Sarfraz Ahmed was stumped after dancing down the pitch.
Bishoo's figures trumped Michael Holding's 8-92 against England at the Oval in 1976 - the previous best for a West Indian outside of the Caribbean.
The complacent batting gave the West Indies hope of an unlikely victory for the first time in the match, as they look to chase a first Test win in 12 matches.
However, should the visitors pull it off, the chase of 346 would rank as the third highest in Test history. #Cricket