2001 Hyundai Elantra Owner here with the exact same symptoms, SOLVED for me! Car started fine, idled a little rough but barely noticeable. Would accelerate decent for the 1st 1/4 mile or so, then would lose power. RPM's wouldn't go over 3,000 and could not get it above 40 MPH. Would barely make it up hills. Codes given: p1166, 0120, 0422, 0136, 0130. Had cleared some codes along the way. Basically the codes were saying both 02 sensors were indicating rich conditions, there was an issue with my throttle sensor, there was a problem with my catalytic converter. This is how I solved it
-Took off heat shield from main catalytic converter. Saw cracks in the exhaust manifold. Remembered there was a recall from campaign V04. Called Hyundai of America and asked if they would honor it. They set up an appointment at my local Hyundai dealer to verify my claims. They installed a new Catalytic converter. Problem remained
-Changed upstream o2 sensor. Problem remained
-Changed downstream o2 sensor. Problem remained
-Did a voltage check on the throttle sensor. Throttle sensor was working properly
-Removed spark plug cover and noticed oil around spark plug wires. Proceeded to install new valve cover gaskets, spark plug gaskets, change spark plugs, change wires. Problem remained
-Removed fuel injector bank. Made a make shift cleaner after watching a youtube video. Each fuel injector opened with test voltage. Each injector streamed properly with makeshift cleaner and voltage applied. Problem remained
-Went to Autozone and rented fuel pressure kit. Disconnected the fuel line entering fuel bank and cut some line and retrofitted the gauge with the provided T in the kit and some fuel hose and hose clamps. Fuel pressure read 48 psi on ignition on. Fuel pressure read 48 psi with engine idle. Put a small 2x4 under the hood and routed gauge to window and drove around. Car continued to drive like garbage but the fuel pressure never dropped below 48 psi or went above 48 psi. Car held the pressure for 15 minutes after shut off (this meant no leaky injectors which is a problem of running rich) sigh. Problem remained
-Used a $10 odb2 plugin bluetooth scanner that my wife bought off amazon for my birthday with the torque app and put up some real time gauges. This included Intake pressure, Vacuum, o2 bank one sensor voltage, throttle percentage, rpms, fuel trim short term, fuel trim long term, and fuel trim. I didn't really know what I was looking for since I never used this before. What stood out as I drove around was that my Vacuum would keep dropping to about 1 whenever I accelerated. Even if the throttle was only open like 10% or as much as 60%. I found this odd and thought that it shouldn't just go all the way down to 1 no matter what the throttle was. I don't know if I would have saw this sitting in the driveway idled. I drove around while running this app and that is when I noticed the vacuum number going to 1. I google vacuum pressures and found out that if the vacuum goes between 1 and 5 consistently when driving and accelerating, there is most likely an EXHAUST BLOCKAGE.
I went outside and luckily there were 2 nice new bolts and nuts allowing me to easily separate the newly installed catalytic converter (Hyundai recall) to my old existing pipe which includes the secondary catalytic converter, the center pipe and then the muffler. Once separated, I started the car (very loud because muffler is out of the system) and drove off. Full power restored!!!!! Transmission was shifting through gears like it should! Problem solved!!! There is an exhaust restriction somewhere after my new catalytic converter. Decided to ebay the secondary cat, the center pipe, and muffler and got it all for under $290.
If you know someone who understand diagnostic numbers, they should be able to figure this out without throwing tons of money at parts with no fix. For me, the internet, the odb2, the torque app, some luck and persistence got me to the finish line.