A method of manufacturing a semiconductor device, the method comprising forming a thin film containing a predetermined element, carbon, nitrogen and a borazine ring skeleton on a substrate by performing a cycle for a first predetermined number of times, the cycle comprising:
- forming a first layer containing the predetermined element, a halogen group, carbon and nitrogen by performing supplying a first precursor gas containing the predetermined element and the halogen group to the substrate and supplying a second precursor gas containing the predetermined element and an amino group to the substrate, for a second predetermined number of times;
- and
- forming a second layer containing the predetermined element, carbon, nitrogen and the borazine ring skeleton by supplying a reaction gas containing a borazine compound to the substrate and allowing the first layer to react with the borazine compound to modify the first layer under a condition in which the borazine ring skeleton in the borazine compound is maintained.