The invention provides a wellhead foam content detection sensor, which belongs to the field of natural gas extraction equipment, and consists of a column body, a lower sealing gasket, a toughened glass sheet, an upper sealing gasket, an internal and external thread bushing, an infrared emitting head, a silicon photocell, a silicon photocell seat, a battery pack, a processing circuit, a wireless transmission module, a box body, a box bottom, a box cover, a sealing ring, a bolt and a flange plate, the foam content is measured according to infrared signals with different intensities received by the silicon photocells installed on the inner and outer wire bushing, the box body is welded to the column body, and the battery pack, the processing circuit and the wireless transmitting module are installed at the box bottom and connected with the silicon photocells and the infrared transmitting head through wires to form a loop. The foam content detection sensor is connected to the gas production pipeline through a flange plate and transmits data to the display unit in a wireless mode. The detection data has the advantages of real-time performance, high precision and good stability, the resource cost is saved, the economic benefit is improved, the gas production process is analyzed in real time, and the production stability is improved.