Engine shuts off

I have a 2003 Ford Focus with the Zetec 2L, 16 valve. When the car is warm and I put it in neutral or park and take my foot off of the brake it will occasionally shut off. Not stall, but shut off - as though I turned the key. This doesn’t happen every time; it usually doesn’t. I have no other drivability problems and there are no warning lights or engine codes. The ideas I have are:

  1. vacuum/ brake booster leak
  2. MAF problem or dirty throttle body
  3. something weird going on with the transmission shift interlock mechanism.

Just curious to see if anyone has suggestions. Thanks.

Sounds more like it is related to the ignition lock or maybe a battery connection

A vacuum/booster leak would set a P0171 lean code
A bad MAF might very well set a code and cause driveability complaints
A dirty throttle body would cause a rough/high idle

You may want to hook up a scanner and check for stored codes