Rare-earth doped crystals have long coherence times and the potential to provide quantum interfaces between microwave and optical photons. Such applications benefit from a high cooperativity between the spin ensemble and a microwave cavity-this motivates an increase in the rare-earth ion concentration which in turn impacts the spin coherence lifetime. We measure spin dynamics of two rare-earth spin species, 145 Nd and Yb, doped into Y 2 SiO 5 , coupled to a planar microwave resonator in the high-cooperativity regime, in the temperature range 1.2 K to 14 mK. We identify relevant decoherence mechanisms, including instantaneous diffusion arising from resonant spins and temperature-dependent spectral diffusion from impurity electron and nuclear spins in the environment. We explore two methods to mitigate the effects of spectral diffusion in the Yb system in the low-temperature limit, first, using magnetic fields of up to 1 T to suppress impurity spin dynamics and, second, using transitions with low effective g factors to reduce sensitivity to such dynamics. Finally, we demonstrate how the "clock transition" present in the 171 Yb system at zero field can be used to increase coherence times up to T 2 = 6(1) ms.