The force of gravity affects both light and all material bodies; since both carry energy, but only the bodies carry mass, it follows that gravity will affect anything carrying energy. This conclusion lies at the root of the construction of Einstein's equations which describe gravity.
Note that this conclusion has some rather strange consequences. Consider for example a satellite in orbit around the Earth, when the Sun shines on it it will increase its energy (it warms up), and gravity's pull with it. When the satellite is in darkness it will radiate heat, lose energy and the force of gravity on it will decrease .
Again let me emphasize that this argument is not intended to imply that light carries mass, but that gravity will affect anything that carries energy.