The fuel sending unit going bad is a fairly common problem on 1st gen Xterra's. In my specific case the Xterra would run for 20 minute intervals before choking itself out. After a short while I would be able to restart and drive another short distance before it would shortly die out again.
What wrong?
The fuel pump connector on the sending unit develops corrosion. This corrosion causes a bad connection. The bad connection causes the engine to shut off as it kills the power to the fuel pump. You might drive for a short while building up heat at this connection until it gets to hot and no longer conducts good enough to pass the power to the fuel pump. After you stall out and let it cool it will revert back to its old ways. Of course yours could also be so far gone you get no power to the fuel pump at all.
Before you tear into it. This is a free voluntary recall so call your dealership with your Vin number to check that this has been done. If it hasn't been replaced they should do it for free. In my case my sending unit went bad again for a second time and the dealer would not replace it more then once.
Last one on this page.
http://www.lemonauto.com/complaints/nissan/xterra.htm
You need a new sending unit and gasket if your doing it yourself. Mine ran me $95 with seal at my local dealership.
1. IMPORTANT:Begin the install by disconnecting the battery don't want the chance of any sparks.
2. Remove the rear passenger seat cushion.
3. Under the seat cushion you will find a hidden trap door.
4. Remove trap door cover. (Would make a great place to hide "something" shhh didn't hear it from me.)
5. Remove secondary cover push the grommet in and through.
6. Carefully remove both connectors from the fuel sending unit.
7. Push the green tabs to release the fuel lines. Fuel will spill out have a rag ready. I like paper towel as I can easily safely dispose of it (light it on fire in backyard later, lol) Mark one of the lines I put electrical tape on the rear most line as so I knew where it went.
8. Remove the bolts and ring around the sending unit.
9. Raise sending unit take note of hoses and locations.
10. Tie off a shoe string then thread the string through each line tying a knot at each line and wire. This will prevent the hoses and wires from falling into the tank later. It will allow you to quickly reconnect them later without having to dig for them in a possibly full gas tank.
11. Disconnect hoses and wires from sending unit.
12. Remove unit
13. Remove gasket.
14. Reinstall in reverse order of write up.
What wrong?
The fuel pump connector on the sending unit develops corrosion. This corrosion causes a bad connection. The bad connection causes the engine to shut off as it kills the power to the fuel pump. You might drive for a short while building up heat at this connection until it gets to hot and no longer conducts good enough to pass the power to the fuel pump. After you stall out and let it cool it will revert back to its old ways. Of course yours could also be so far gone you get no power to the fuel pump at all.

Before you tear into it. This is a free voluntary recall so call your dealership with your Vin number to check that this has been done. If it hasn't been replaced they should do it for free. In my case my sending unit went bad again for a second time and the dealer would not replace it more then once.
Last one on this page.
http://www.lemonauto.com/complaints/nissan/xterra.htm
You need a new sending unit and gasket if your doing it yourself. Mine ran me $95 with seal at my local dealership.
1. IMPORTANT:Begin the install by disconnecting the battery don't want the chance of any sparks.
2. Remove the rear passenger seat cushion.
3. Under the seat cushion you will find a hidden trap door.

4. Remove trap door cover. (Would make a great place to hide "something" shhh didn't hear it from me.)

5. Remove secondary cover push the grommet in and through.

6. Carefully remove both connectors from the fuel sending unit.

7. Push the green tabs to release the fuel lines. Fuel will spill out have a rag ready. I like paper towel as I can easily safely dispose of it (light it on fire in backyard later, lol) Mark one of the lines I put electrical tape on the rear most line as so I knew where it went.

8. Remove the bolts and ring around the sending unit.

9. Raise sending unit take note of hoses and locations.

10. Tie off a shoe string then thread the string through each line tying a knot at each line and wire. This will prevent the hoses and wires from falling into the tank later. It will allow you to quickly reconnect them later without having to dig for them in a possibly full gas tank.

11. Disconnect hoses and wires from sending unit.

12. Remove unit

13. Remove gasket.

14. Reinstall in reverse order of write up.