What I like to do is eliminate as much as possible first.
The moment it shuts off, see if it still has spark. If it does, you can ignore the entire ignition system and move on to the fuel side.
Why am I even talking about spark? When the mags start to fail, they'll get sensitive to heat. A few minutes of not running is enough to cool off to run again.
This does sound kind of like a tank venting problem, but I have a diagnostic triage flowchart in my head that I don't like to deviate from.