Backfiring from the throttlebody on 1991 Ford F-150

I have a 91 f 150and it cranks and idle great, but at times while i'm driving it backfires and seems as if its out of gas, but when i click the fuel auxiliary switch from front to rear and buck to the front it run right for 2 or 3 minutes and start all over again. Can someone please give me some insight on this problem thanks.

Asked by for the 1991 Ford F-150
bad fuelpump