If changing the thermocouple and/or gas valve doesn't help, and your water
heater is in the attic, your problem may be it's not getting enough oxygen.
I know it sounds crazy, but both my units in my Texas home are in the attic
and I was having the same problem. I changed the thermocouple and the gas
valve to no avail.
During a call to a service rep, he told me about the oxygen thing and said a
small fan blowing at the base of the heater during the heat of the afternoon
I put a little 5"-6" fan on a timer, pointed it at the base of the heater
and I haven't had any more problems with the pilot light going out.
There is no safety for honest men except by believing
all possible evil of evil men. - Edmund Burke