P0171 and P0174 are lean fuel codes - P0325 is a knock sensor code. Ignore the P0325 for now, as it may be related to the fuel issue.
Look for vacuum leaks with the lean codes. Specifically - on this engine - if it's the SOHC 4.0L V6 - it is notorious for failure of the intake manifold o-ring gaskets. I would guess that the leak is there.
RepairPal Certified shops can diagnose and repair your 1999 Ford Explorer. They provide transparent pricing with a minimum 12-month or 12,000-mile warranty on repairs and services.