Retiring captain Misbah-ul-Haq made 99 for the second consecutive Test but Azhar Ali scored his 13th hundred in the longest format as Pakistan had the better of day three against West Indies at the Kensington Oval.
Misbah was left stranded just a run short of an 11th Test century in the first innings of the opening Test at Sabina Park last week and came agonisingly close again in Barbados on Tuesday.
The 42-year-old, who will retire after the three-match series with the Windies, trudged off shaking his head after he was dismissed by Jason Holder.
Misbah deserved a hundred for a superb knock on a deteriorating pitch and Azhar succeeded where his skipper failed, scoring a patient 105 as Pakistan made 393 all out in reply to 312.
Shannon Gabriel took 4-81 and the economical Holder 3-42 to restrict Pakistan's lead to 81 before Mohammad Abbas got rid of Kieran Powell to leave the Windies on 40-1 at stumps, trailing by 41.
Runs were hard to come by on a difficult track with uneven bounce under overcast skies early when the tourists resumed on 172-3 on the third day.
Only 54 runs were added by Pakistan in a drab morning session, but Azhar and Misbah got the scoreboard ticking over after lunch, the captain launching Roston Chase for six down the ground after bringing up his second half-century of his final international series.
The watchful Azhar was content to bide his time and saluted before dropping to kiss the turf after bringing up his century off 268 balls, cutting a short ball from Devendra Bishoo past point for his ninth boundary.
Bishoo finally saw the back of the opener in his next over, though, getting one to turn away and catch the outside edge to offer a chance which Shane Dowrich took behind the stumps.
The positive Misbah launched Bishoo down the ground and into the stands, but when it seemed a hundred was inevitable after he looked so comfortable all day, there was a dramatic twist.
Holder played the mind games by going for an optimistic review when he struck Misbah on the pads on 99, but the ball was going well over the top. He got his man from the next ball, though, when the right-hander gloved a rising delivery to Shai Hope at gully.
The last five Pakistan wickets fell for 77 runs, with Gabriel and the impressive Holder combining to wrap up the innings, but not before Yasir Shah (24) had frustrated them on his 31st birthday.
Abbas struck with his fourth ball thanks to a superb diving catch from wicketkeeper Sarfraz Ahmed after Powell got an inside edge, but no further damage was done.