1999 honda civic

sometimes car wont start. after a few minutes it will. other times i can be driving down the highway and it will just die. will start back up after a couple of minutes. i have changed spark plugs and wires, fuel filter and O2 sensor.

There is a two-pack relay, the PGM-FI relay, which often is the cause of this. It controls electrical power to the fuel pump and the engine computer. A relay, used anywhere, can be intermittent. Your engine is fuel injected, isn’t it? Does the check engine light (symbol) come on? If it does, get the code and follow the troubleshooting chart.
The PGM-FI relay is under the dash, on the driver’s side. It cost about $60.
The next suspect is the distributor. It’s more expensive. Troubleshooting these components is difficulty, especially, the distributor.