What you are describing sounds like it could be related to the crankshaft position sensor. When these sensors begin to fail, they are affected by heat. When they get hot enough, the engine loses spark and shuts off or runs poorly. Then, if you give it a chance to cool a bit, it runs again.
Do me a favor. Take a look through this link. It describes the most common symptoms related to the crankshaft position sensor.
If you feel that mirrors what you experience, you can check if spark is lost when the engine won't start. You can do that using a live data scan tool, watching if the RPM gauge moves a bit when cranking (it won't if the sensor is bad), or you can check for spark at the plugs.
Here is a link showing how to test for spark:
If you find no RPM signal or no spark, the first suspect is the sensor. Here is a link that explains in general how it is done:
If you look at the attached pics below, they provide the directions specific to your vehicle for replacement.
Let me know if this helps or if you have other questions.
See pics below.
Images (Click to make bigger)
Saturday, July 24th, 2021 AT 7:57 PM