A temperature sensor comprising: a case including a body portion and a tubular portion projecting outward from the body portion, the tubular portion being formed in a tubular shape closed at a side defining a tip; a temperature sensor element arranged within the tubular portion at the tip; a wire member having one end connected to the temperature sensor element; a holder to which the other end of the wire member is fixed; a substrate to which the other end of the wire member is electrically connected, the holder and the substrate being placed in the body portion; a retaining portion disposed within the tubular portion at a position closer to the body portion than the temperature sensor element, the retaining portion being filled with a retaining material to support the wire member, wherein a gap between the holder, the substrate, and the body portion of the case is filled with the retaining material; and a heat insulating section disposed between the temperature sensor element and the retaining portion, the heat insulating section including a heat insulating member made of a less heat-transferable material than the retaining material, wherein the heat insulating member in the heat insulating section is fixed around the wire member at a position near the temperature sensor element, wherein the temperature sensor element is pressed against the tip of the tubular portion, wherein the heat insulating member is made of foam polystyrene or a phenol resin, wherein the heat insulating section includes a gap portion filled with gas kept between the heat insulating member and the temperature sensor element, and wherein the retaining material is made of epoxy. a case including a body portion and a tubular portion projecting outward from the body portion, the tubular portion being formed in a tubular shape closed at a side defining a tip; a temperature sensor element arranged within the tubular portion at the tip; a wire member having one end connected to the temperature sensor element; a holder to which the other end of the wire member is fixed; a substrate to which the other end of the wire member is electrically connected, the holder and the substrate being placed in the body portion; a retaining portion disposed within the tubular portion at a position closer to the body portion than the temperature sensor element, the retaining portion being filled with a retaining material to support the wire member, wherein a gap between the holder, the substrate, and the body portion of the case is filled with the retaining material; and a heat insulating section disposed between the temperature sensor element and the retaining portion, the heat insulating section including a heat insulating member made of a less heat-transferable material than the retaining material, wherein the heat insulating member in the heat insulating section is fixed around the wire member at a position near the temperature sensor element, wherein the temperature sensor element is pressed against the tip of the tubular portion, wherein the heat insulating member is made of foam polystyrene or a phenol resin, wherein the heat insulating section includes a gap portion filled with gas kept between the heat insulating member and the temperature sensor element, and wherein the retaining material is made of epoxy.