Several years back I had the same problem with the Onan Microquiet 4KY generator in our MH. The generator would run for 15-20 minutes, then surge like a lawn mower does when it runs out of gas and shut down. After this happened, the generator would crank OK but wouldn't restart. I discovered that if I waited for 1/2 hour or so, the generator would start and run for another 15-20 minutes before surging and quitting.
Our generator has a "prime" function on the start rocker switch at the generator. This function runs the fuel pump without cranking the starter, which allowed me to hear whether the fuel pump was running. I found that if I tried the prime right after the generator shut down by itself, there was no buzzing sound from the fuel pump. A 1/2 hour later, using prime would give me the normal sound from the pump. I figured that the pump must be heating up and seizing after running for a short while.
Replaced the fuel pump and no more problems since. Replaced the fuel filter while I was at it.