We analyze the commutation relations of light-ray operators in conformal field theories. We first establish the algebra of light-ray operators built out of higher spin currents in free CFTs and find explicit expressions for the corresponding structure constants. The resulting algebras are remarkably similar to the generalized Zamolodchikov's W_\inftyalgebra in a two-dimensional conformal field theory. We then compute the commutator of generalized energy flow operators in a generic, interacting CFTs in d>2. We show that it receives contribution from the energy flow operator itself, as well as from the light-ray operators built out of scalar primary operators of dimension \Delta \leq d-2, that are present in the OPE of two stress-energy tensors. Commutators of light-ray operators considered in the present paper lead to CFT sum rules which generalize the superconvergence relations and naturally connect to the dispersive sum rules, both of which have been studied recently.