Gas has a lower density than liquids because it is not compressed as tightly as liquids, meaning there are fewer atoms per unit of volume. In a liquid, atoms are free to move but remain closely associated, while in a gas, atoms have lots of free space between one another.
Note that while the densities of both liquids and gases can vary with temperature and pressure, the density of a gas is always considerably lower than that of a liquid. Also, with significant pressure, a gas can be forced to condense into a liquid. One tool that explores the relationship between temperature, pressure and the phase of a substance is a phase diagram.