This could be a number of things. You will need to break it down first between it losing spark or fuel and or both. Common problems like you are describing could be an ignition module getting hot and cutting off.
Try replacing the ECM relay in the box under the hood.
Possibly the crank case oil sensor. Had the same symptoms on a Buick LeSabre '91
car starts but shut off while driving
Ford f350 super duty shut off and lose power while driving
Out of gas
If you lost power while driving it could be the alternator. Its not charging your batter anymore
Check to see if the catalytic converter is plugged. Does the car sound like it has a restricted exhaust? Does it glow red (nighttime check). When was the last time you changed the fuel filter? Do you have spark & fuel when it dies?
Possible a bad or corroded ground cable .
no gas
Probably the alternator.
Peeing off the side
check fuel pump or ignition system