A method of producing a temperature sensor which is configured to detect a temperature change of a respiratory gas of a subject, includes: preparing a rod-like heat sensitive element which includes a heat sensitive portion in a tip end portion; placing the heat sensitive portion in a cavity of a mold; injecting a resin material into the cavity to mold a protective portion which covers the heat sensitive element; and releasing the tip end portion in which the protective portion is formed, from the mold.