Abstract. Driven by diverse applications, several recent models impose randomly switching boundary conditions on either a PDE or SDE. The purpose of this paper is to provide tools for calculating statistics of these models and to establish a connection between these two perspectives on diffusion in a random environment. Under general conditions, we prove that the moments of a solution to a randomly switching PDE satisfy a hierarchy of BVPs with lower order moments coupling to higher order moments at the boundaries. Further, we prove that joint exit statistics for a set of particles following a randomly switching SDE satisfy a corresponding hierarchy of BVPs. In particular, the M -th moment of a solution to a switching PDE corresponds to exit statistics for M particles following a switching SDE. We note that though the particles are non-interacting, they are nonetheless correlated because they all follow the same switching SDE. Finally, we give several examples of how our theorems reveal the sometimes surprising dynamics of these systems.keywords. random PDE, stochastic hybrid system, piecewise deterministic Markov process, randomly switching boundary, switched dynamical system.