Sounds like a poor electrical connection.
Check that all your connections are clean and tight.
I had a similar issue with an '89 Honda dirt bike. It would run fine and then just shut off and not restart until it cooled down. I had it in the shop 3 times before they finally got it to cut out. It was a dirty connection (one of the bullet type connectors) They cleaned it with some 0000 steel wool and the problem never came back.
Intermittant electrical problems can be a pia.

It could be a problem with the shutoff switch wiring as well.
If it is a tiller model check where the wiring runs out of the tiller into the powerhead area as the wiring can rub and crack there.
This should give you a start.