Azhar Ali was run out in embarrassing fashion for 64 as Pakistan extended its lead over Australia to 369 at lunch on the third day Thursday of the second test.

Ali steered a delivery through slips and the ball rolled towards the boundary. Ali didn't run, believing he'd hit a four, and met Asad Shafiq in the middle of the pitch to talk.

But the ball stopped before the boundary at third man, and the chasing Mitchell Starc threw it at the striker's end and captain Tim Paine whipped the bails off.

Australia's Peter Siddle, center, reacts as Pakistan's Asad Shafiq and Babar Azam runs between the wicket during their cricket test match in Abu Dhabi, United Arab Emirates, Thursday, Oct. 18, 2018. (AP PhotoKamran Jebreili)

Australia's Peter Siddle, center, reacts as Pakistan's Asad Shafiq and Babar Azam runs between the wicket during their cricket test match in Abu Dhabi, United Arab Emirates, Thursday, Oct. 18, 2018. (AP PhotoKamran Jebreili)

Ali, playing his 67th test, and Shafiq, playing his 63rd, were dumbfounded while the Australians celebrated a little slice of luck.

That dropped Pakistan to 160-4 in its second innings, but Shafiq and Babar Azam batted confidently to lead their team to lunch on 232-4, and well in control of the test.

Shafiq was 42 not out and Azam was on a fluent 34 that included two sixes off Nathan Lyon. Both batsmen were dismissed without scoring in Pakistan's healthy first innings total of 282, and this time were involved in an unbroken 72-run stand for the fifth wicket.

Australia's Nathan Lyon celebrates the dismissal of Pakistan's Haris Sohail during their cricket test match in Abu Dhabi, United Arab Emirates, Thursday, Oct. 18, 2018. (AP PhotoKamran Jebreili)

Australia's Nathan Lyon celebrates the dismissal of Pakistan's Haris Sohail during their cricket test match in Abu Dhabi, United Arab Emirates, Thursday, Oct. 18, 2018. (AP PhotoKamran Jebreili)

Australia removed both overnight batsmen inside the first hour after Pakistan resumed on 144-2.

Lyon had Haris Sohail stumped on 17 with a delivery that spun away from the lefthander, while Ali ran himself out by not running.

Australia, which was bowled out for 145 in its first innings, wasted both of its video reviews in the first session while looking for breakthrough.

Australia's Tim Paine tries to catch the ball as Pakistan's Asad Shafiq runs to save the wicket during their cricket test match in Abu Dhabi, United Arab Emirates, Thursday, Oct. 18, 2018. (AP PhotoKamran Jebreili)

Australia's Tim Paine tries to catch the ball as Pakistan's Asad Shafiq runs to save the wicket during their cricket test match in Abu Dhabi, United Arab Emirates, Thursday, Oct. 18, 2018. (AP PhotoKamran Jebreili)

Azam survived both lbw video referrals against him, as Pakistan was setting up a daunting target for the visitors.

More AP sports: https://apnews.com/tag/apf-sports and https://twitter.com/AP_Sports