I was having the P0174 and P0171 codes recently (usually one would be pending). Nonetheless, at one point my 2000 Mountaineer w/99K would just die while driving if I didn't hold the accelerator pedal down a bit to idle it. I unplugged the MAF sensor and suddenly I no longer had to hold down the accelerator pedal. I swapped the MAF sensor at a cost of about $131 wholesale. (Later a Master Ford Mechanic told me the MAF sensor rarely goes bad.)
Sure enough the codes came back about 2 weeks later. I thought it was the o-rings and needed the 00M12 kit that is talked about so much. But none of my neighborhood mechanics were convinced and wanted to tackle the job. They dismantled the MAF Sensor and chocked it out and the truck died (so they thought no leak). WRONG
Just brought it in to the dealer for a diagnosis @$85 bucks and they confirmed it was the o-ring problem. The rattling you are hearing is the cam shaft tensioner that comes with the kit. The reason it only affects a cold engine is that when the engine is hot the plastic rings expand and stop the leak (I think I remembered that right). Stop guessing and get this done if you haven't already that is if you have the V-6 SOHC engine (not sure if other engines was affected). The kit was about $35 wholesale and $45 retail. The installation is what will kill you at a dealer (I think they bill it at 4 hours). Nonetheless, if you are mechanically inclined I do have a hardcopy of the instructions and can fax them to you.
My truck sounds much better now and runs great. Now I have to figure out how to get my front end to be like new again. I know I need some sway bar bushings....the saga continues.