i checked the fuel pump and had a mechanic check it it is working
Yes, but did it start every time for him? One of the real headaches in diagnosing intermittents like this is that the problem/symptom has to occur while the technician is doing the diagnosis. If the problem/symptom doesn't occur while the mechanic has the truck (Murphy's Law), then the mechanic isn't going to be able to diagnose it.
Did your mechanic pull codes? I had a similar problem, that finally occurred when I was in a position to diagnose it, and it turned out to be a loose connection between the fuel pump fuse and the fuel pump relay. Occasionally, before I figure it out, I would get a CM 542/543 out of the computer. Basically, the computer was seeing the loose connection before the problem got so bad that I could see it. If nobody's pulled codes, yet, I'd do that and see if there are any clues in the computer.
As suggested, you might go through the fuel pump and EEC power circuits and see if there are any obvious loose connections. Maybe wiggle connectors and see if you can make it stall. Several years ago, my Explorer would "randomly" stall while off-roading. Eventually, after some frustration, we figured out that, when my wife got nervous or "excessively" bounced around, she would press her foot into the floorboard near the inertia switch (she didn't know it was there). That pressure was causing the connection to the fuel pump to temporarily break there. With a little luck, a wigle test like this might allow you to locate where a critical circuit is losing continuity.
Beyond that, my best advice is to be patient and keep at it. Intermittents like this can be the most frustrating to diagnose, and sometimes require patience.