I had that happen to me once a number of years ago.
I drove into a restaurant parking lot with a friend, went in for a meal, and came out to leave.
It did exactly the same thing you described.
Long story short, I started poking around and saw some fuel on the ground, right below the fuel filter.
I got in there to look, and some stupid dipsnot who must have know about dmax's reached in over the front tire and opened the drain cock on the bottom of my filter housing.
I cranked it back shut, and the truck started right up and never had another issue.
Can't believe somebody would do that!
I relate this story because perhaps, as mentioned above, you have an issue with your fuel filter causing the injector pump to suck air.