There have been a number of reports of problems with cam position sensors failing when hot and causing the engine to run rough and sometimes stall - the problem disappears if the engine is allowed to cool down.
The cam position sensor is on the back of the exhaust cam between the cylinder head and the firewall - put a bottle of water and a rag in the car, and the next time the problem occurs wet the rag and use it to cool the sensor, if that allows the car to start & run, replace the sensor.