This paper considers the mean square output containment control problem for heterogeneous multi-agent systems (MASs) with randomly switching topologies and nonuniform distributed delays. By modeling the switching topologies as a continuous-time Markov process and taking the distributed delays into consideration, a novel distributed containment observer is proposed to estimate the convex hull spanned by the leaders' states. A novel distributed output feedback containment controller is then designed without using the prior knowledge of distributed delays. By constructing a novel switching Lyapunov functional, the output containment control problem is then solved in the sense of mean square under an easily-verifiable sufficient condition. Finally, two numerical examples are given to show the effectiveness of the proposed controller.