how about the flame detector? once the pilot is on, the flame sensor detects the flame and opens the valve. if it is a millivolt thermopile generator, perhaps it isn't providing the 500 millvolt output to the main valve. on the millivolt line inside the valve is an insulator and a copper button. if the insulator is shot or near shot sometimes you'll get the low voltage and the valve operates normal. other times the output shorts out and the pilot never lights.