Since you hear the pump run when the key is turned to run and the truck won't start, that rules out the PCM relay, the fuel pump inertia switch, and the fuel pump relay.
Checking for fuel pressure at the fuel rail will be a very good indication. In the event you don't have a pressure gauge handy the next time it won't start, try cycling the key 2-3 times to build more pressure and see if it starts right up that way. So turn the key to Run, let the pump run and turn off, turn the key off for about 5 seconds, back to Run, repeat two more times, then try to start the engine. If it fires right up, that would indicate the pump is struggling to provide sufficient fuel pressure for a start up.
-Rod