I have had car batteries do this same thing. Start up fine, drive in traffic in the heat. Stop to get gas or something and it wouldn't start. Leave hood up to cool off for a while and it would start. If the battery is old, I wouldn't even mess with it, replace it. And check the things the other guys said.