Called a thermocouple that stays in the flame as it burns. It is a safety device that turns the gas off if it is not hot so gas just doesn't go in your house. Sometimes the thermocouple gets dirty and cleaning it with a scotch Brite or steel wool will fix it. Sometimes it goes bad and you need to buy a new on a replace it, an easy job.