'97 Honda Accord electrical problem

Have had great luck with my Honda until now. It has 175,000 mi on it and had the ignition switch replaced (recall) a few years ago.

Within the last few weeks it has started stalling out on me while I’m driving. No warning, just suddenly no power. It will go for a few days without a problem and then start quitting out again. Last night it cut out 6 times on the way home. Although it immediately restarts, I don’t want this happening on a major hightway.

The problem appears to be electrical. Could there be something wrong with the ignition switch or are we talking something more major? Love the car, but need to be able to trust it.

My first guess would be the main relay, located under the dash. Try tapping it while the car idles and see if the engine cuts out.

My first guess is, also, the main relay (aka PGM-FI relay). The distributor (containing three sensors) is the next suspect.
Since faults won’t show when the PGM-FI relay is operating normally, you can’t do definitive test on it. What you can do is replace the PGM-FI relay, and then, watch the results. A new PGM-FI relay is about $70.
There is a test that you could do; but, very few will do. In this test, one removes the PGM-FI relay, and jumpers the wiring harness connector to it. Jumper the female terminal of the red/orange wire to both the yellow/black wire female terminal and the black/yellow wire female terminal. This wires the fuse 23 power to the fuel pump, and to the fuel injectors. If the car behaves all better, the fix is to replace the PGM-FI relay. If no change, investigate the distributor and the ignition switch (I know, it’s newish).
This is the pertinent wiring diagram (#7 down). You may have to register (easy) at the site to view it.

Thanks for your suggestion.
I have a 4-cyl, not a 6 cyl Honda Accord. Is this still the same part number (PGM-Fl)?

“PGM-FI relay” is the generic name of the part, not the part number.
Just give your parts supplier the model and year etc. of your car.
They are found on most fuel injected Hondas since 1985.

They can also be opened and repaired with basic soldering skills.