It seems to happen more under harder acceleration. Check engine flashes when it happens. I replaced fuel filter. Advance autos scan would not read code.
Why does car miss and hesitate while accelerating? Check engine light is on. on 2000 Volvo S40
I've seen spark plugs that are non-Volvo, or even Volvo plugs with 20,000+ miles cause misfires. You may also have a bad coil too. Try new Volvo plugs and see if that helps. Try not to drive when the light is flashing, this will damage your catalytic converter $$$.
Need to get the code. Go to different places like Autozone or Oreilly auto,Checker/Kragen auto parts for free code scan.