Yes. In general relativity and cosmology, the collection of galaxies is often even treated as an ideal fluid, in the thermodynamic sense, with temperature and pressure.
The standard textbook on general relativity, the book Gravitation by Misner, Thorne, and Wheeler, discusses this model in Section 27.2, though only on the thermodynamic level.
For the statistical mechanics of gravitation, see, e.g.,
Systems with negative specific heat,
Z. Physik 235 (1970), 339-352.
This is for inside a star, but a similar analysis works on the level of galaxies. See, e.g.,
Ahmad et al.,
Statistical Mechanics of the Cosmological Many-Body Problem,
The Astrophysical Journal 571 (2002), 576-584.
A free online copy is at