Sputtering, won't hit passing gear

My 2003 Subaru Forester has been having troubles lately. Sometimes, when it’s fully warmed up and after I’ve driven at least 30 miles, it starts sputtering and won’t hit the passing gear. If I give it even a little extra gas, the RPMs go wild but it won’t accelerate. Sometimes the Check Engine light comes on. Once it slowed so much on the highway that I pulled over, turned it off, and restarted it. It was mostly fine but I didn’t push it. Once it cools down, it usually gets better, and overnight the Check Engine light normally goes off. At the dealer, they told us it was the O2 sensor, which they replaced, but it didn’t fix it. We also changed the spark plugs, fuel filter and air filter, to no avail. Then it’s normal again for a week or so, and one day, she starts sputtering again.

WHY??

Since you say when you give it a little extra gas your RPMs go wild but the car doesn’t speed up, you definitely have a tranny problem. The not going onto passing gear is part of the same problem.

Your description suggests it’s an automatic. Have you checked your tranny fluid lately? Is it at the proper level (you owner’s manual will tell you how to check)? How’s the color? Does it smell burned?

Remove the mass air flow sensor and use an appropriate product (try CAF) to clean the wire connections. Reconnect it after it dries, and if the problem reoccurs, replace the part.

Excuse me, but what about the post makes you sure it is the MAF sensor? Especially when the 2.5L 4 cylinder doesn’t use one?