Ivan,
So things to think about going forward:
If the entire electrical system shuts down, it may very well be the main electrical relay. If all lights and electrical functions shut off simultaneously this could be the issue. Testing would be to simply replace it. They are usually much cheaper than sensors.
It may also be the main cabling for the alternator and battery. Your starter wire, alternator wire, or battery terminal may be corroded and be intermittently failing. Testing would be visual inspection on all exposed metal on the battery, alternator and fusebox connections, and/or getting an auto parts house to run their checker on your battery system to see if anything is out of tolerance.
Another thing to check would be the ignition switch. If it is old, corroded, or failing it may be cutting off the ignition with vibrations. Check by "jiggling" the key vigorously while running to see if you can reproduce the problem that way.
Electrical issues can be difficult sometimes to pin-down. Some other things to think about and further research would be loose connectors and possible shorts.
Cheers