Agreed. This is the first and easiest test. If that doesn't solve the problem, you need to determine what is missing when the motor shuts off, fuel or spark. This could be an electronic or electical component becoming heat-sensitive.Try unscrewing the fuel tank cap 1 turn to vent the tank.
if that "fixes" it... then your cap vent is not working.