The first-principles phonon calculation is a powerful tool for understanding and predicting phonon dynamics in solids. However, the widely used harmonic approximation breaks down when the thermal or zero-point amplitude of atomic vibrations becomes significant. Also, it is unable to handle phonon physics relevant to the lattice anharmonicity, including lattice thermal conductivity and the structural phase transition. To overcome this limitation, in recent years, new ab initio phonon calculation methods, which can treat anharmonic effects beyond the quasiharmonic level, have been developed. In this article, we introduce self-consistent phonon theory that can compute finite-temperature phonon dispersion as well as many-body perturbation theory for calculating phonon lifetimes. We demonstrate the validity and versatility of these methods through their applications to SrTiO3 and Ba8Ga16Ge30.