I think you have a bad MAF. If you replaced it with anything other than a Motorcraft sensor you are likely to have problems. I learned that the hard way. You don't have to get Motorcraft from the dealer,
roackauto.com carries them. Before just popping for a new sensor, you should run a few tests on your old one, and check the wiring to make sure it is getting the proper reference voltage and such. I went through 2 aftermarket MAF sensors on my Aerostar, which is almost the same as your B4000, before I went with an OEM one. Even then I had an issue with the first dealer one being bad. They switched it out for another and all is well now.
If you are running a K&N or other oil coated filter, switch back to stock.