1999 Volvo V70 starts but stalls intermittently

My 1999 Volvo V70 is having intermittent issues starting/stalling out. Sometimes it will start right up and go, other times, it will start and the rpms will fluctuate then it stalls/shuts off or will go in gear but fluctuate rpms irradically it will do this multiple times after 3 or more restarts it will run fine until it is turned off then the same thing all over again. Any help is greatly appreciated.

i own an 06 s40. the same thing was happening to me and it turned out to be the gas cap wasnt on all the way. it sounds crazy but it true.

Make sure all the routine engine maintenance is up to date. And have all the ECM codes, current and pending, read and post them there. If that doesn’t fix it, then I suspect a vacuum leak of some kind. Unmetered air may be getting into the engine and making it run too lean.