I had the error code P0138 coming up on my 98 Civic EX which was telling me my second O2 sensor needed replacing. This O2 sensor has 82,000 miles on it and is the original sensor. I was surprised that there are no write-ups about this on the site so I figured that I would make one as I changed mine.
1. I drove the front of the car up onto ramps, put two jack stands under the car for safety, and blocked one of the back tires.
2. Disconnect the battery. This is for safety and to reset the ECU.
3. The O2 sensor is located under the car directly underneath the center console. It is easiest to get at from the passenger side.
4. Depending on how much rust there on the sensor determines how much effort is needed to get the O2 sensor off. The safest and easiest way to get the O2 sensor off is to run the car for a minute or two in order to heat the catalytic converter up. This causes the metal to expand and should make it easier to pull the O2 sensor off. I was not lucky enough for this to work, I then tried a spray to loosen the bolt (failed as well). The final resort and what worked for me was an acetylene torch. Caution that this could damage the catalytic converter because it so close to the O2 sensor but if used fast and only on the area that needs it you will be fine. I also needed a special O2 sensor removal tool because of the clearance underneath the car I could not get a traditional O2 socket wrench on the old sensor or install the new sensor with it. It is a crows foot socket wrench that I ordered on amazon. It worked great for removal and installation.
5. Once the sensor is out of the socket you will need to un-clip it in the car, the clip is located in the center console. In order to get to it you will need to remove the black box at the bottom. This is done with a screwdriver and one screw on the passenger side and driver side. Once the screws are out the plastic clip in that the screw went into will need to be removed (they just pop out) and then use a flat headed screwdriver to separate the two halfs of it apart.
6. Once it is apart the O2 sensor plug is located on the passenger side underneath the rug (I had to cut the rug a little to get at it). This comes undone by hand.
7. There is a plastic washer that goes into around the O2 sensor wire that also needs to be pulled out and replaced. I recommend just getting a new washer from a hardware store because I was unable to slip the stock one around either side of the O2 sensor.
8. Now install the new O2 sensor into the cat and run the wire through the hole in the firewall into the clip to connect it to the car. Don't forget to use some type of never seize on the O2 sensor threads so it can be removed again. A light layer on the threads is all you will need and don't get any on the sensor or it may be damaged.
9. Installation of everything is the reverse of taking it apart, once it is all set hook the battery back up and put the car on the ground. You should have a new O2 sensor fully functional in the car.
I put around 20 miles on the car today after doing this and have had no ECU or check engine light come up. Also my temp gauge is slightly lower then what is used to be, so I am hoping that I will get better gas mileage in the future.