We consider a finiteness condition on centralizers in a group G, namely that |C_G(x):⟨x⟩|<∞ for every ⟨x⟩⋪G. For periodic groups, this is the same as |C_G(x)|<∞ for every ⟨x⟩⋪G. We give a full description of locally finite groups satisfying this condition. As it turns out, they are a special type of cyclic extensions of Dedekind groups. We also study a variation of our condition, where the requirement of finiteness is replaced with a bound: |C_G(x):⟨x⟩|≤n for every ⟨x⟩⋪G, for some fixed n. In this case, we are able to extend our analysis to the class of periodic locally graded groups. The research that led to the present paper was partially supported by a grant of the group GNSAGA of INdAM