Subaru Impreza Outback 2002 check engine light

My check engine light comes on when going downhill, usually on steep grades. This has been happening for years, it will usually go off at some point. Over the last 6 months, in addition to the light coming on, the car will virtually die when I come to a stop at the bottom of the hill, not stall, just die. It starts right up again.
I’ve had it serviced 3 times over the last 6 mos and the mechanic said several codes were in there and he replaced a couple parts, light still came on and he said it could be an O2 sensor.
Don’t want to put much more $$ into this car if I can help it. It has 120K miles and is a 5 speed. Any ideas?

“the car will virtually die when I come to a stop at the bottom of the hill, not stall, just die. It starts right up again.”

Either it stalls or it doesn’t. If it restarts then it is a stall. If it will not restart then i would say it has died.

But in any case with out the code it is showing while the light is on you will likely get little help except for guesses. See if you can get the codes pulled while the light is on and post back.

You need to check with the mechanic and get the problem code and pass it along to us. It should be in the format {P1234}

With that information we have a much better chance of giving good advice.

You say you had it "serviced." How about telling us what service was done?  As far as I can tell, you may have had the oil changed or a new engine and transmission installed.