Temperature dependence of the magnetocrystalline anisotropy energy and magnetization of the prototypical rare-earth magnet YCo5 is calculated from first principles, utilizing the relativistic disordered local-moment approach. We discuss a strategy to enhance the finite-temperature anisotropy field by hole doping, paving the way for an improvement of the coercivity near room temperature or higher. © 2014 American Physical Society.