Pakistan's Azhar Ali was run out in bizarre fashion on day three of the second Test against Australia after believing the ball had gone for four.