2 possibilities: electronic components can fail when they get hot. That could be anything from the electronic ignition system to the fuel pump. The other possibility is the fuel filter could be plugging up with sediment which slowly closes off the filter element. Turning off the fuel pump briefly can allow the sediment to settle, letting the filter function briefly again. You need to try to find out why it stalls. Is it lack of fuel? Try to start it immediately after stalling, by using a little starting fluid. If it starts briefly when you shoot a little starting fluid, you probably have a fuel pump or filter problem.