Potential energy between molecules arises because of intermoleuclar force. The intermolecular force is attractive in nature and decreases rapidly with increase of molecular separation.
For an attractive force, in order to increase the distance between two objects (molecules in this case), work has to be done. This is just similar to the situation that if you raise a book from the floor, i.e. increasing the distance between the book and the earth surface, you need to do work onto the book. As a result, the (gravitational) potential energy of the book is increased.
In that sense, whenever there is an increase in separation between molecules in a substance, work has to be done and the potential energy of these molecules will be increased.
即係點解氣體既勢能會比固體既勢能大?
The reason is apparent. Because the density of a fixed mass of a given substance in gas state is much smaller than the density of the same substance in solid state, that is, the volume occupied by the fixed mass of gas is larger than the volume occupied by substance in solid form. The molecules in gas state are thus more widely dispersed. Therefore, separation between molecules in gases is much much larger than separation in soilds. For reason as explained avoce, the larger the separation, the larger is the potential energy of molecules.
This is the reason why to turn a solid into its gas state, large amount of energy is needed.
As the spaces between the particles/molecules are larger, particles/molecules can move more freely which means to have HIGHER energy( potential energy ).
Therefore, the matter with a gas state has a higher potential energy than with a solid state.