Strong growth at its cloud unit and a bullish sales outlook eased fears that the tech giant was falling behind rivals in the AI race.