Babar Azam fell one short of a maiden Test century after a farcical Azhar Ali run out as Pakistan put themselves well on course for victory over Australia in Abu Dhabi on day three.
Azhar threw his wicket away comically for 64 at Sheikh Zayed Stadium, Mitchell Starc zipping in a throw and Paine whipping off the bails as the number three casually chatted to Asad Shafiq out of his ground thinking he had struck a boundary.
There was also agony for Babar when he was dismissed for 99, but Pakistan should have the last laugh after declaring on 400-9 to set the tourists a highly unlikely 538 to win.
Usman Khawaja's magnificent century denied Pakistan in the first Test, but he was unable to open due to a knee injury on Thursday and his replacement, Shaun Marsh, fell cheaply as Australia were reduced to 47-1 at stumps.
Sarfraz Ahmed (81) earlier made a second half-century of the match, with Nathan Lyon taking 4-135 on a gruelling day for Australia.
Lyon struck in the sixth over of the day with a flighted delivery which deceived an advancing Haris Sohail, who was stumped by Paine.
Azhar followed in bizarre fashion soon after to leave Pakistan 160-4, but Babar and Shafiq capitalised on an excellent batting surface in a stand of 75.
Shafiq was twice dropped by Marnus Labuschagne at short leg off Lyon before the all-rounder dismissed him for 44 in the afternoon session.
Babar had brought up his half-century and continued to tick along effortlessly, launching Labuschagne for six over long-off before Sarfraz did the same to Lyon straight after sweeping him to the boundary.
Peter Siddle rattled Sarfraz on the helmet, but the skipper brought up his second half-century of the match and Babar was on the brink of a first Test hundred when he was trapped leg before by Mitchell Marsh.
Babar reviewed, in hope more than expectation, but was sent on his way after hitting three sixes and another six boundaries in an excellent knock, putting on 133 for the sixth wicket with Sarfraz.
Bilal Asif smashed Labuschagne's first ball after tea for a straight six, but he and fellow spinner Yasir Shah fell in the same Lyon over, much to the frustration of Sarfraz.
Sarfraz decided it was time to deal in boundaries, but missed out on a hundred again when Labuschagne snared him leg before and declared soon after trudging off.
Stand-in opener Shaun Marsh failed for the fourth time in the series, bowled by a peach of a delivery from Mir Hamza which nipped away and struck the top of off stump.
Aaron Finch and Travis Head prevented any further damage from being done, but Pakistan have two days to take the nine wickets needed to win the series.
|Ferraris fastest on stop-start day in Baku|
|Inter can chip away at Juve´s Serie A dominance - Spalletti|
|Emery riled by questions over Arsenal form|
|PSG´s season a waste without Coupe de France win – Marquinhos|
|Kovac only focused on Bayern ahead of Bundesliga title run-in|
|Rabbitohs edge out as Panthers as Bulldogs find their bark|
|Billings out of England´s limited-overs squads|
|Pochettino feels sorry for Kane but hints at early return|
|Guardiola waits on Fernandinho as De Bruyne remains out|
|Sarri expecting determined Man United response|
|Williams´ Russell to miss FP2 after manhole mayhem|
|NFL ´done messed up´ letting Redskins pick Haskins|
|Rudiger ready, Kante a doubt for Chelsea´s Manchester United showdown|
|Neymar: Hazard and I would cause havoc together|
|Suarez excited for Anfield reunion: My daughter remembers singing You´ll Never Walk Alone|
|Crusaders tame Lions for 25th straight home win|
|Melbourne City 5 Central Coast Mariners 0: Tottenham-owned Harrison leads rout with brilliant brace|
|Ter Stegen targets Germany No.1 spot|
|Juve the team Inter want to beat, says Nainggolan|
|Mo´unga commits to New Zealand and Crusaders|
|If you want to see me get kicked, watch MMA instead – Neymar|
|Cardiff hit by season-ending Ralls injury|
|Beale worried about Folau´s ´head space´|
|Solskjaer: I think Pogba will stay Man United|
|You can´t criticise a goalkeeper for one game – Pickford defends under-fire De Gea|
|FP1 cancelled in Baku after manhole drama|
|I trust him – Solskjaer refusing to drop struggling De Gea|
|Jets pick Quinnen Williams targets Tom Brady|
|Early success a must for Murray to justify unnecessary Cardinals gamble|
|Liverpool acting like a club that belongs at the top – Henderson|
|Spurs can´t get caught up in Nuggets crowd - DeRozan issues warning ahead of Game 7|
|Zabaleta expects Juventus-linked Guardiola to stay at City|
|Thunder skipper Shane Watson retires from BBL|
|The big Friday Premier League quiz|
|Ravens bring Hollywood to Baltimore, Giants reach for Jones - The best and worst picks of the NFL Dr|
|Bauer leads Indians past Astros|
|Five potential destinations for Josh Rosen after Cardinals pick Kyler Murray|
|Cardinals make Kyler Murray first pick as Giants spring Daniel Jones surprise|
|Copa Libertadores Review: Palmeiras, San Lorenzo punch tickets into last 16|
|Celtics Hall of Famer Havlicek dies aged 79|
|Cardinals´ Kyler Murray: I want to be best that ever played|
|Spurs top Nuggets to force Game 7|
|Ince ´sick and tired´ of nostalgic Solskjaer|
|Haskins falls to Redskins in NFL Draft|
|Stallings, Mullinax lead rain-affected Zurich Classic|
|Klopp never expected United to get a result in Manchester derby|
|Bosa ´excited to go kick butt´ with 49ers|
|Baker Mayfield leads congratulations to top draft pick Kyler Murray|
|Giants take Eli Manning successor in Daniel Jones|
|New York Giants fan wins season tickets for 100 years|
|Zidane hails ´fearless´ Diaz|
|Chiefs star Mahomes graces Madden 20 cover|
|Nick Bosa goes second to 49ers in NFL Draft|
|Cardinals take Kyler Murray first overall in NFL Draft|
|´I don´t really care what people say´ – Westbrook on criticism|
|Lakers star LeBron James tops NBA jersey sales|
|This Week in US Sports: NHL playoffs putting NBA postseason to shame|
|Madrid have turned down €180m for Asensio, says agent|
|Man City ´fighting like animals´ to hold off Liverpool – Fernandinho|
|Zidane annoyed with Getafe stalemate|
|Gasperini targets ´extraordinary´ finish to season for Coppa finalists Atalanta|
|Singleton to leave Worcester for Sarries|
|Liverpool beat Manchester City on penalties in FA Youth Cup final|
|Defending champ Pliskova dumped out in Stuttgart|
|NHL apologises to Golden Knights for controversial penalty call|
|Smith one clear at Trophee Hassan II|
|Getafe 0 Real Madrid 0: Zidane´s men held by Champions League chasers|
|Atalanta 2 Fiorentina 1 (5-4 agg): Gasperini´s men through to Coppa Italia final|
|Struff stuns Tsitsipas to set up Nadal quarter-final|
|Adebayor claims racism motivated infamous celebration|