Why is my gas heater shutting down the flame and pilot?
Bad thermocouple - it is supposed to sense the presence of a flame, and turn off the gas if it is on, but nothing is getting hot.

Last one I replaced was less than $10 at home depot, it is held in with only a screw or two, and less than an hour of work, including the beer after fixing my friends water heater.

Looks like this, they are pretty much universal.

http://www.lowes.com/pd_26369-135-6910476_0__?productId=3133513