What you observe with your eyes is the intensity of the light beam, not the toal energy of the beam.
Intensity of the beam is the energy of light incident on unit area per unit time, such as the energy falling per unit time onto the retina of your eyes.
When travelling in air, a beam of light generally spreads out, and hence its energy will spread over a larger area as it goes. This reduces its intensity and leads you to have the feeling that the light is weakened. Apart from this, there is absorption of light by the dust particles suspended in the air that transform part of the light energy into other forms of energy.
Without absorption of a medium (e.g. the atmosphere), light can travel a very long distance. A simple example is that we can observe light coming from distant stars millions of light-years from earth. The reason is that there is only little materials (in the form of atoms and molecules) in the interstellar space between earth and stars, hence this gives little absorption to light emiited from these stars. The light doesn't disappear away.