Polymer-derived ceramic (PDC) thin-film sensors have a very high potential for extreme environments. However, the erosion caused by high-temperature airflow at the hot-end poses a significant challenge to the stability of PDC thin-film sensors. Here, we fabricate a thin-film coating by PDC/TiB2/B composite ceramic material, which can be used to enhance the oxidation resistance and ablation resistance of the sensors. Due to the formation of a dense oxide layer on the surface of the thin-film coating in a high-temperature air environment, it effectively prevents the ingress of oxygen as a pivotal barrier. The coating exhibits an exceptionally thin oxide layer thickness of merely 8 μm, while its oxidation resistance was rigorously assessed under air exposure at 800 °C, proving its enduring protection for a minimum duration of 10 h. Additionally, during ablation testing using a flame gun that can generate temperatures of up to 1000 °C, the linear ablation rate of thin-film coating is merely 1.04 μm/min. Our analysis reveals that the volatilization of B2O3 occurs while new SiO2 is formed on the thin-film coating surface. This phenomenon leads to the absorption of heat, thereby enhancing the ablative resistance performance of the thin-film sensor. The results indicate that the thin-film sensor exhibits exceptional resistance to oxidation and ablation when protected by the coating, which has great potential for aerospace applications.