We develop a finite-temperature perturbation theory (beyond the mean field) for a Bose-condensed gas and calculate temperature-dependent damping rates and energy shifts for Bogolyubov excitations of any energy. The theory is generalized for the case of excitations in a spatially inhomogeneous (trapped) Bose-condensed gas, where we emphasize the principal importance of inhomogeneity of the condensate density profile and develop the method of calculating the self-energy functions. The use of the theory is demonstrated by calculating the damping rates and energy shifts of low-energy quasiclassical excitations, i.e., the quasiclassical excitations with energies much smaller than the mean-field interaction between particles. In this case the boundary region of the condensate plays a crucial role and the result for the damping rates and energy shifts is completely different from that in spatially homogeneous gases. We also analyze the frequency shifts and damping of sound waves in cylindrical Bose condensates and discuss the role of damping in the recent MIT experiment on the sound propagation.