I have had an acclaim and a spirit and both would randomly shut off like that. I had to clean or replace both of there fuel pump connectors. They would get corroded and the fuel pump would shut off intermediately.

On another car it was the logic controller under the dash, behind the passenger kickpanel.

Good luck. I hate electrical gremlins.