In this paper, we analyze the effects of expansion on large scale structure formation in our Universe. We do that by incorporating a cosmological constant term in the gravitational partition function. This gravitational partition function with a cosmological constant is used for analyzing the thermodynamics of this system. We analyze the virial expansion for this system, and obtain its equation of state. It is observed that the generalization of this equation of state is like the Van der Waals equation. We also analyze a gravitational phase transition in this system using the mean field theory. We construct the cosmic energy equation for this system of galaxies, and discuss its consequences. We obtain and analyze the distribution function for this system, using the gravitational partition function. We also compare the results obtained in this paper with the observational data.