It runs for a hour or so, once it’s parked it won’t start back.

Once the car is drove than it sits for an hour or so it won't start back. Sometimes it will start then I get to a stop sign or realign the then it dies, after and hour or so it will start back.

My car has 170237 miles.
My car has an automatic transmission.

Experienced mechanics share their insights in answering this question :
There is a GM problem report for the Pontiac G6 with this issue that identifies a loose, or corroded connector for the primary high-speed communication "bus" for the engine, transmission and other components (known as the CAN bus). Check with your GM service manager for PIC4677E, which deals with correcting this problem and the symptoms you are experiencing.

If you’d like a second opinion on this, have a certified technician, like one from YourMechanic, diagnose your starting problem firsthand and advise you what to do from there.

How to Identify and Fix Common car Problems ?

Our sources include academic articles, blog posts, and personal essays from experienced mechanics :

The most common reasons a Pontiac G6 engine stalling are the fuel system, the air intake system, or the ignition system.
The most common reasons a Pontiac G6 won`t start are a dead battery, an alternator problem, or failed starter.
If the torque converter is broken, or if there is a low fluid level in the transmission, the converter will not do its job, and the car will be unable to maintain power at low speeds, which causes the engine to shut off. A defective TCS or torque converter solenoid can also cause this issue.
Problems with the 2007 G6 are fairly serious including steering issues, headlight failures, and frequent oil leaks. Steering problems are the most common complaint from owners showing up at around 50,000 miles. The steering makes clunking and snapping noises and the steering shaft is the source of the problem.
Some of the most common sensors that lead to engine stalling include the mass airflow sensor (MAF), engine coolant temperature sensor (ECT) and manifold absolute pressure sesnsor (MAP). The idle air control valve (IAC) and exhaust gas recirculation valve (EGR) are also well known for causing engine stalling.
It could be a dead alternator, a bad coolant sensor or lack of fuel, just to name a few. Is your car stalling while accelerating? If so, then it could be a major vacuum leak, clogged fuel filter or a bad fuel pump. If your vehicle is stalling when driving, seek professional help to track down and fix the issue.
The most common and obvious reason your car may start then die is the fuel shortage in your engine. This happens because there`s not enough fuel in the fuel rail, and there`s no fuel pressure to keep the engine alive. The reason isn`t always you forgetting to fill up your gas tank.
Engines usually stop suddenly only if they suffer from a lack of fuel or sparks . An engine that stops dead without prior warning has probably had a sudden ignition failure – although if it locks solid it`s more likely to have seized.
Common reasons for this to happen:

Low fuel pressure, dirty or defective fuel injectors, or broken fuel pump: The fuel pump is responsible for transferring fuel from the tank to the engine.

Key Takeaway With proper care and following a regular maintenance schedule, your Pontiac G6 can last up to 270,000 miles and upwards of 15 years.
The estimated cost to maintain and repair a Pontiac G6 ranges from $95 to $1774, with an average of $271.
There are three major causes for a stalled engine: A lack of fuel, a lack of air flow and improper ignition. Running out of fuel is one of the most common causes of engine stalling, but dirty fuel injectors or a plugged fuel filter can also be the culprit. Your engine needs air to run properly as well.
A defective oil control valve won`t close properly, resulting in rough idling, engine stalling, and poor engine performance. Poor Engine Acceleration and Performance: depending on the camshafts` phase, the engine will generate more power or conserve fuel.
Bad solenoid may be causing vehicle to stall.
This sensor controls ignition timing of the engine and when it fails the computer does not know when to ignite the cylinder causing the engine to stall and not start correctly. I would recommend having a technician from YourMechanic come out and replace the sensor.
The P0700 code indicates that there`s a malfunction with your vehicle`s Transmission Control Module (TCM). This computer monitors your transmission and works with the Powertrain Control Module (PCM) and Engine Control Module (ECM) to shift gears when necessary.
Error code P0449 indicates a malfunction within the vehicle`s evaporative emissions control (EVAP) system. The code specifies an issue regarding the circuit that controls the vent.
Summary: General Motors (GM) is recalling certain model year 2007-2010 Saturn Aura and model year 2008-2010 Chevrolet Malibu and Pontiac G6 vehicles, equipped with a 4-speed automatic transmission. On these vehicles, the tabs on the transmission shift cable end may fracture and separate.
A Bad Crankshaft Position Sensor

The crankshaft position sensor monitors the position and rotational speeds of the crankshaft. Without the crank sensor, the engine control module (ECM) wouldn`t know when to fire the fuel injectors and ignite the spark plugs.

If the engine stalls while idling or driving, the engine may be running out of fuel or not receiving enough fuel pressure to keep it running. The most likely cause of this kind of stalling would be a fuel pump that is not spinning fast enough or is intermittently cutting out.
Faulty spark plugs can cause the car to exhibit starting troubles. Worn out plugs does not produce sufficient sparks, which is needed for starting the engine. This results in the engine to stall and fail to start quickly.
When a bad module is responsible for an intermittent stalling problem, the engine will usually cold start just fine and run OK for short distances, but stalls after driving more than a few miles or when driving at highway speeds (especially during hot weather). It`s as if somebody suddenly turned off the ignition.
There are three major causes for a stalled engine: A lack of fuel, a lack of air flow and improper ignition. Running out of fuel is one of the most common causes of engine stalling, but dirty fuel injectors or a plugged fuel filter can also be the culprit.
Finally, the Pontiac G6 GXP features a 3.6-liter V6 good for 252 hp and 251 lb-ft of torque. A six-speed automatic is standard. In performance testing, we achieved a 0-60 time of 6.2 seconds in a GXP coupe. Fuel economy ratings are 17 city/26 highway and 20 combined, which is average for sedans with that much power.

Relevant Questions and Answers :

the most relevant questions and answers related to your specific issue

New battery & fuel pump. Hours later car starts and shuts down 3X in a row. Finally it starts, 48 hours later, won’t start at all
ANSWER : Checking all the fuses was a good move. I would also want to put a scan tool on it and check for diagnostic trouble codes (DTCs) as well as seeing the data that the computer is seeing.

A fuel pressure test would be a good idea to verify correct pressure and so that you’d be able to eliminate that possibility. It should be 58psi on your Magnum.

I also recommend getting your battery tested (I know, it’s new, have it tested anyway) and be sure it’s charged to at least 75%. And yes, loose battery cable connections can result in electrical problems.

If you need some assistance with this, consider enlisting a certified mechanic who can perform the checks I’ve mentioned and diagnose your starting issue firsthand. The mechanic can then perform the necessary repairs once the problem has been isolated. Good luck.

Vehicle won’t start, once it’s jump started it only stays running until you turn it off, then it work start again without jumping.
ANSWER : Hi there. There could be two problems here. It is possible that your battery is bad and will not take a charge from your alternator while driving. In that case every time you shut your car off you will not have enough juice to start it again. Inspect your battery – it should have at least 12.5 to 13 volts to start your car, if it doesn’t you will need to replace the battery. The second problem could be that your alternator is bad and not charging your battery, in this case you will need to replace your alternator. Both the battery and the alternator can be tested in your car. If you would like to have the car checked for you, a certified professional from YourMechanic can come to your car’s location to diagnose the starting problem and proceed with repairs.

It runs for a hour or so, once it’s parked it won’t start back.
ANSWER : There is a GM problem report for the Pontiac G6 with this issue that identifies a loose, or corroded connector for the primary high-speed communication "bus" for the engine, transmission and other components (known as the CAN bus). Check with your GM service manager for PIC4677E, which deals with correcting this problem and the symptoms you are experiencing.

If you’d like a second opinion on this, have a certified technician, like one from YourMechanic, diagnose your starting problem firsthand and advise you what to do from there.

Car won’t start. When trying to start, starter makes a clicking noise and then closed back hatch recloses.
ANSWER : It sounds like there is some type of drain on the battery. When there is low voltage in a battery, it can cause several symptoms. The electrical systems can act very strangely when they don’t have the correct voltage being supplied. When a battery won’t hold a charge, it can be caused by a wiring issue, a bad battery, or some type of parasitic draw that can slowly pull voltage from the battery. Some electrical diagnosis done by a professional, such as one from YourMechanic, will be necessary to pinpoint the cause.

Wont start (Click), shift gear from P to R then back to P Starts it, after runs for a while it starts up fine.
ANSWER : Your vehicle has something called a neutral safety switch that will prevent the vehicle from starting when it is in any gear position other than park or neutral. Occasionally, this switch can malfunction causing the car to stall as soon as you put it into any gear. This switch usually also monitors gear selection data as well to transmit back to the computer. This switch is connected to the starter solenoid which allows it to complete the starter circuit only when the transmission is in park or neutral. I would suggest having a professional from YourMechanic come to your location to diagnose and inspect your vehicle.

When I shut off my vehicle after driving it for an hour or more it won’t immediately start back up. At first, it will just click a
ANSWER : The intermittent no start condition you are describing will not damage the car. Obviously, though, an intermittent no start condition such as this can cause great inconvenience. If the symptom is no starter motor operation at all, it relatively easy to pin this down. The next time you experience no starter motor operation, hold the key in the start position and have an assistant use a voltmeter to check for battery voltage at the starter solenoid. If there is battery voltage to the solenoid, and yet no starter motor operation, you probably have a starter that has an intermittent fault. Sometimes, in these cases, if you strike the starter motor body sharply with a rubber mallet the starter will then work when you try the key. If striking with a rubber mallet works, that typically means there is a bad spot on the armature. The vibration from striking the motor simply moves the armature just enough to get it off the bad spot. Obviously, the solution is to drive around with a rubber mallet in your trunk. All kidding aside, you have some sort of intermittent fault and it will be discoverable if you request a no start diagnostic. Please let us know if you have further concerns or questions as we are always here to help you.

took my 2002 suburan to the chevy garage and I told them how I had to put it in park, then neutral ,then back to park to start the
ANSWER : Even from a distance, my gut tells me this issue is shifter-related. The shifter cable or mechanism can be worn or out of adjustment. It can be just enough that it does not sit in Park or Neutral just so. Then shifting back and forth moves it just enough that it starts. It may even be the Neutral-Safety Switch. The neutral safety switch is typically located on or near the shifter linkage on the transmission. It performs a few functions. It connects to the ignition to prevent the vehicle from being started in any gears other than park and neutral. It cal also signal the reverse lights when you shift to reverse. I would have the shifter mechanism looked at and if determined to be the case, replace the neutral safety switch.

Fuel pump engages. Batery good, alternator good volts, jump start helps when wont start. Temp does not matter. Intermittent?
ANSWER : Hello. Thank you for writing in. There are several reasons your vehicle may only start when jump starting. The first and most common is a build up of resistance that is causing you to need a boost of voltage to get the engine started. This may be due to poor battery cables, a bad ground connection, a poor starter solenoid, and a couple of other issues. The first thing you want to do is perform a visual inspection of the starting system. Make sure there is no corrosion build up in the battery cables. You can also check the resistance across these wires and make sure you have a solid connection between components. You then want to make sure the starter solenoid is doing its job. It is responsible for taking the small amount of electricity sent by the ignition and turning it into a huge electrical charge that is strong enough to push over the engine with the help of some gear ratios in its favor. Do some more testing, and stick to the basics before assuming its something seriously complicated.