A gas sensor includes a protective cover having a resin cylindrical cover portion at a rear end thereof, that can be airtightly attached to an attachment hole, and that can prevent a decrease in quality and a molding defect. A plurality of vertical ribs, which extend substantially parallel to an axis of a cylindrical cover portion, are formed on an outer peripheral surface of the cylindrical cover portion so that protrusions and recesses are provided in a circumferential direction. Due to the presence of the vertical ribs, as compared with an existing cylindrical cover portion that has a smooth outer peripheral surface without the vertical ribs, defects of the outer peripheral surface are not likely to occur in a molding process. Moreover, because slipping is not likely to occur when an operator holds and twists the cylindrical cover portion with his/her fingers, an attachment operation can be smoothly performed.