My John Deere had the same problem, it would run until the vaccum in the tank kept the fuel pump from being able to pump gas to the carb. After letting it set for about 10 minutes the vaccum leaked away and the mower would start again and run for another 10 minutes. If that is the problem it will ruin the fuel pump if you don't fix it fast and then you will have to replace the fuel pump too. Don't let it go long enough for that to happen. Loosen the cap or buy a new one before you mow again. If the cap is loose enough the motor will not die when hot if the vent hole is the problem. It doesn't cost anything to try this first.