Had the same problem with my 97 4.2. Found out that after replacing the DPFE sensor,and EGR,,the plumbing between the intake assy,and the exhaust manifild was absolutely nasty. My truck was showing 186,000 miles on it at the time.
Also..the DPFE sensors(oem) are prone to moisture corrosion from the vapor,and carbon in the exhaust flow. The new sensors are plastic(not an aluminum alloy)...These plastic ones seem to be resistant to that corrosion issue...lastly,alot of aftermarkey DPFE sensors were built with wider tolerances,and even if good,will throw a code.
Most folks here recommend FORD OEM parts,and while I do concur with that theory,I was lucky. I bought mine from
www.rockauto.com and while NOT Ford OEM worked flawlessly until I traded her in on the 07.