Taunton - Yasir Shah took four wickets and Azhar Ali made a century but Pakistan were denied victory as their England tour opener against Somerset ended in a draw.
Leg-spinner Shah took four for 107 in 32 overs as Somerset, set an improbable 468 for victory, finished on 258 for eight at Taunton on Tuesday.
Jack Leach (six not out) and Tim Groenewald (four not out) survived the last 16 balls of this three-day fixture.
Earlier, veteran former England opener Marcus Trescothick made his 47th first-class hundred for Somerset.
That equalled West Indies great Vivian Richards's tally for the south-west county and left the 40-year-old Trescothick just two shy of Harold Gimblett's Somerset record of 49 first-class centuries.
Pakistan resumed Tuesday on 140 for four, with Azhar Ali 50 not out and Asad Shafiq unbeaten on 26.
Ali went on to make 101 not out and shared a stand of 138 in 30 overs with Shafiq (69 not out) as Pakistan made 236 for four declared in their second innings.
As soon as Ali had gone to his century, in 168 balls including 12 fours and two sixes, Pakistan captain Misbah-ul-Haq closed the innings.
Adam Hose was out off what became the last ball before lunch when he was lbw to Shah for eight after he missed a quick, straight ball.
Tim Rouse had made 14 when, taking his eye off the ball, he ducked into a rapid Mohammad Amir delivery and was struck on the helmet.
A concerned Amir raised his hand in apology and Rouse, who changed helmets, needed at least five minutes of on-field treatment before resuming his innings.
But soon afterwards he gamely cover-drove Amir for four.
Amir's exciting career came to a shuddering halt during a Lord's Test in 2010 when he and new-ball partner Mohammad Asif were caught bowling no-balls to order on the instructions of captain Salman Butt as part of a tabloid newspaper sting operation.
All three received five-year bans from cricket and jail terms.
But the 24-year-old Amir is now back in England and could make his Test return in the first of a four-match series at Lord's on July 14.
This was Amir's maiden first-class match in England since the spot-fixing row and he took three for 36 in Somerset's first innings, swinging the ball at sharp pace.
Trescothick was caught behind off Amir for just eight in the first innings but, with sunny conditions favouring batsmen, drove him down the ground on Tuesday.
Rouse fell in similar fashion to Hose when he was lbw to Shah's quicker ball after making a gutsy 41 on his Somerset first-class debut and sharing a stand of 98 with Trescothick.
Trescothick was 95 not out at tea, with Somerset 157 for two.
The left-hander drove Shah for a single to go to a 105-ball century with 18 fours and a six.
Trescothick was out soon afterwards, for 106, when he flat-footedly drove at a wide delivery from Rahat Ali and was caught behind.
Somerset's 183 for three soon became 226 for six, with Peter Trego playing on to Rahat Ali for a duck and James Hildreth (48) caught behind off Amir -- his lone wicket on Tuesday.
Shah had Josh Davey dropped when Amir floored a simple catch at mid-off before bowling the Scotland paceman to leave Somerset 234 for seven.
After several close calls, teenager Dom Bess eventually fell lbw to Shah for 27.
That left Somerset 251 for eight but Pakistan were unable to force a victory.
Pakistan now have one more three-day game, against Sussex at Hove starting Friday, before the first Test.