Really not enough info provided on the problem to help you.
What does it do when it "dies"? Is there spark? fuel?
That being said, it sounds like it could be a heat related issue. A few things I have seen:
1) Check the key switch connector and the switch itself. If the connection is poor, it can heat up with time and not function properly. Same thing for other connections where there is high current running through it. Mostly PTO clutch and charging circuits.
2) Weak coil getting hot and loosing power...
Could also be a randomized problem, like wiring rubbing on the frame. This most likely would be the kill wire to the coil. Could also be in the safety circuits (seat switch etc.).
If you post more details on how it acts when it dies, it would be helpful. (is it sudden? does it stutter, then die? Does it run without any indication of a problem until then?)
Also, model / spec information on engine...
Good luck.