Thermal conductivity (κ) is a key transport parameter in the fields of thermoelectric, heat management, and other functional materials research. For a long time, it is generally accepted that phonon-phonon interactions dominate the phonon thermal conductivity in semiconductors, which are the parent compounds of thermoelectric materials. Despite the well-known effect of electron-phonon interactions on the charge carrier mobility, the same on the thermal conductivity only starts to attract attention recently. In this work, we solved the Boltzmann transport equations for phonons considering both phonon-phonon interactions and electron-phonon interactions obtained from first principles calculations. It is demonstrated that electron-phonon interactions could also have a pronounced effect on the phonon transport properties, especially when the carrier concentration is large. A case study is given in Mg-based thermoelectric materials.