I had that problem - I called the repairman out and he charged me $100 dollars to clean the heat sensor. Last time it did it, I took it apart myself and cleaned it with sandpaper. On mine, it was held under the burn plate with 4 screws.
There is a sensor that senses heat after the flame is on. It kills the gas supply if it doesn't sense heat in a few seconds. This is to prevent the furnace from pumping gas in to the house if the fire isn't lit. I think they used to call it a 'thermo couple" in the old days. the problem is they get carbon build-up on the tip that prevents them from accurately sensing the fire.
The probe piece on the left gets carbon build-up.
http://en.wikipedia.org/wiki/Thermocouple#Heating_appliance_safetyHeating appliance safety
Many gas-fed heating appliances such as ovens and water heaters make use of a pilot light to ignite the main gas burner as required. If the pilot light becomes extinguished for any reason, there is the potential for un-combusted gas to be released into the surrounding area, thereby creating both risk of fire and a health hazard. To prevent such a danger, some appliances use a thermocouple as a fail-safe control to sense when the pilot light is burning. The tip of the thermocouple is placed in the pilot flame. The resultant voltage, typically around 20 mV, operates the gas supply valve responsible for feeding the pilot. So long as the pilot flame remains lit, the thermocouple remains hot and holds the pilot gas valve open. If the pilot light goes out, the temperature will fall along with a corresponding drop in voltage across the thermocouple leads, removing power from the valve. The valve closes, shutting off the gas and halting this unsafe condition.
Some systems, known as millivolt control systems, extend this concept to the main gas valve as well. Not only does the voltage created by the pilot thermocouple activate the pilot gas valve, it is also routed through a thermostat to power the main gas valve as well. Here, a larger voltage is needed than in a pilot flame safety system described above, and a thermopile is used rather than a single thermocouple. Such a system requires no external source of electricity for its operation and so can operate during a power failure, provided all the related system components allow for this. Note that this excludes common forced air furnaces because external power is required to operate the blower motor, but this feature is especially useful for un-powered convection heaters.
A similar gas shut-off safety mechanism using a thermocouple is sometimes employed to ensure that the main burner ignites within a certain time period, shutting off the main burner gas supply valve should that not happen.
Out of concern for energy wasted by the standing pilot, designers of many newer appliances have switched to an electronically controlled pilot-less ignition, also called intermittent ignition. With no standing pilot flame, there is no risk of gas buildup should the flame go out, so these appliances do not need thermocouple-based safety pilot safety switches. As these designs lose the benefit of operation without a continuous source of electricity, standing pilots are still used in some appliances.