The net effect of intermolecular forces and thermal energy decides the state of the matter.
Intermolecular interactions: Strength of intermolecular interactions is highest in solids, then in liquids and least in gases.
Thermal Energy: Thermal energy of the gaseous state particles is maximum, then is the thermal energy of liquid particles and least thermal energy is of solid particles.