Miata does not like long drives

My 2001 Mazda miata dies out after I drive about 100 highway miles, if I let it sit 10- 15 minutes it starts up again. It will usually run for a while with the check engine light on, if I let it sit for a few hours it is ok again. I have changed the fuel filter , do you think it is the fuel pump, ( why so intermitent) just recently I drove it after it had been sitting for a few weeks and it died after only half an hour of driving. I waited 10 min. And it was ok. My mechanic isn’t sure a new fuel pump will correct it. Whata ya think?

Have the check engine codes read–it is free at most auto parts chains. (advance, pepboys, auto zone, etc) Without that it is a 100% guessing game.

Report them back in the form “P0123”, not the descriptions of possible solutions.

You need to get the codes read to get an accurate diagnosis. I suspect that the codes will point to a defective purge valve, but that is only a SWAG. Many auto parts stores will read the codes for free, get the actual code or codes and post them here. The codes will be in a format of a letter followed by four numbers, like P0446.

If you are one of those people who chronically overfills the gas tank, that is you add more gas after the handle shuts off the first time, you may have saturated the canister and the system can’t breath. It is remotely possible that if you stop this, the system will eventually clear itself, but since you have gone to the point of stalling, it probably is too late for that to work.

It sounds like something is overheating. It could be many things. That CEL (check engine light) is just a kid in class waving her hand trying to get you attention because she has the answer. You need to have the codes read. Some places will read them for FREE. Try Autozone or Advanced Auto Parts. Get the exact code (like P0123) not just their translation into English and post it back here.

thanks, all, it just happened after driving only 5 miles. was able to get it to the shop with check engine light on. code says P1345 cylinder discriminator signal from CMP sensor . any ideas as to what that means? Thanks.
my local mechanic is doing some research.

P1345 - (Mazda) Camshaft Position Sensor circuit problem

If the camshaft position sensor signal gets lost, the engine will lose timing for the ignition and fuel injectors. This is most likely the cause of the engine shutting off or run very rough. I’d test the circuit and the connectors before replacing the sensor.