My name is Dale.
The first thing I would do is hook up a fuel pressure and volume tester at the fuel rail on the engine under the hood. It really sounds like the fuel pump is on its way out. (could be wrong) But that what it sounds like. I would also hook up a OBD II Scanner to the engine and run it in the live mode while the vehicle is doing the bad thing and see what is failing. Could be plugged converter, etc. Either way you need to run the diagnostics on the engine to tell what is happening.
Once I have answered your question, Please Don't forget to "Accept", I do not get paid unless you do accept my answer