Thermal stability of passivating layers in amorphous/crystalline silicon (a-Si/c-Si) heterojunction solar cells is crucial for industrial processing and long-term device stability. Hydrogenated amorphous silicon (a-Si:H) yields outstanding surface passivation as atomic hydrogen saturates silicon dangling bonds at the a-Si/c-Si interface. Yet, a-Si surface passivation typically starts to degrade already at annealing temperatures in the range of 200 to 250 °C depending on annealing time, and optical absorption in front layers of a-Si reduces the short circuit current density. We show that oxygen incorporation into a-Si:H films enhances the thermal stability of the passivation and reduces parasitic absorption. We further show that for good passivation of the a-Si/c-Si interface, a compact material structure of the a-Si:O:H films is required where atomic hydrogen is the dominating type of diffusing hydrogen species. For plasma deposited a-Si:O:H films, oxygen incorporation of up to 10 at. % leads to an increase of the optical band gap while the hydrogen concentration is almost constant at approximately 10 at. %. For oxygen concentrations below 3%, the films yield surface recombination velocities as low as 10 cm/s on p-type wafers, and the temperature stability improves by about 50 K compared to pure a-Si:H. For films with relatively low oxygen content, hydrogen effusion spectra and Fourier transform infrared spectroscopy (FTIR) indicate a compact microstructure where only atomic H diffuses. For oxygen concentrations above 3%, the passivation quality reduces and H effusion and FTIR suggest the formation of an open, void-rich material where molecular H2 diffuses. In this case, annealing above 400 °C results in improved interface passivation, presumably due to a densification of the material. Likely, this densification results in an increased density of atomic H, which saturates Si dangling bonds near the c-Si interface.