Functionally graded materials have broad engineering applications including mechanical engineering, electronics, chemistry, and biomedical engineering. One notable advantage of such materials is that their stiffness distribution can be optimized to avoid stress concentration. A novel approach for solving the equations describing the longitudinal vibration of functionally graded rods with viscous and elastic boundary conditions is proposed. The characteristic equation of the system is derived for the solution of the undamped case for the constant stiffness rod. Then, a homotopy method is applied to compute the eigenvalues and mode shapes of graded rods for viscoelastic boundary conditions. The changes of the eigenvalues and mode shapes as function of the damping parameters are investigated. The optimal damping of the system is computed. It is shown that the qualitative behavior depends on the relation between the actual damping and the optimal damping of the system. The energy density distribution of graded rods is also discussed. An energy measure, the mean scaled energy density distribution is introduced to characterize the energy distribution along the rod in the asymptotic time limit. The significance of such a measure is that it reveals how the energy tends to distribute along the rod. It is shown that the energy distribution can be manipulated by changing the damping parameters. Qualitative changes depending on the relation between the actual damping and the optimal damping are highlighted.