Why does my mountaineer turn off while its idling and will not start again

Took it to Auto Zone and they said it was the Thermostat. Even took to a dealer and they said same thing. Well we replace the upper and lower housing and reset light. After about 2 days of driving it was back. Took back to get hooked up and again said the Thermostat. We replaced it again all in about 2 months. What are we missing here? It also has a lil sputter when idling. We have changed spark plugs and wires, filters and oil. HELP PLEASE!

It is a 4.6 v8

I had to unplug from washer motor to get it off plunged back in came back on what would cause this.

What I thought was an exhaust leak maybe valves needing adjustment.

I have an exhaust manifold leak that I am going to replace the manifold gaskets. As I have been a Ford/Mercury owner for decades, I have come to know that one must ask and not assume when attempting to do almost anything involving the engine and adjoining apertures. Any words of wisdom would be appreciated. All my advice from this site has been VERY valuable. THANKS!

You can push accelerator into over drive and the higher rev seems to correct it. The intermittent is getting worse. Feels like no spark to 1 or a few cylinders but intermittently as to almost buck. But not every time you accelerate and doesn't happen when the engine is cold and not up to operating temperature. Ford has checked the computer for misses and they said there were none logged.

Put power to it with a power probe and it works fuse is good and the windshield washers stay on had to unplug.