Check the trouble codes. If you are unsure of how to do this, follow the procedure in this write up...
ECU Error Codes
Usually, except for the cel, the symptoms you are describing are caused by a faulty main fuel relay. The next time this happens, reach down and give the area under the left side of the steering column a couple whacks and see if the car will start. If it does, then the main relay is your culprit. Even if it doesn't start, it could still be the main relay. There is a fix for it that sometimes works, but you may need to replace it if that's the problem. The fix is described here...
Main Relay Fix
Feel free to look around that web site. There is a lot of helpful information contained within that site.