As stars evolve and turn into red giants, asymptotic giant branch stars, and planetary nebulae they engulf the inner planets, evaporating or partially evaporating them depending on how massive they are. As the star loses mass, planets that are not engulfed move further out from the star.