Manchester City booked their place in the final of the Audi Cup after a 5-3 win over AC Milan in Munich.