How new are the crankshaft position sensor, throttle position sensor and fuel pump relay? Try switching the relay with another one that has the same pins.
I had this same problem with my 99 Burb last year. Loaded the parts cannon and replaced TPS,CPS, rotor with a Blue Streak one, and fuel pump and starter relays, over about 6 months. It would be absolutely perfect for 2 or 3 days, or a week, then wouldn't start and stay running at all. Then it would fire right up and run as it should, like nothing was wrong. This issue is what got me to this forum!
I tried all the "relearn " procedures and some worked great and some didn't. I think that what it was, was that the Passlock module under the dashboard was going out. These are circuit boards and after 20+ years of bouncing around they start coming apart. I've read that they can be resoldered or rebuilt, but that wasn't in my options. What I finally did was find a local speed shop that mainly works on and tunes LS's. Camaros,Vettes,CTS-V's, that sort of thing. They looked askance at my old Burb, but I explained what it was doing and what I wanted done. Basically, I had them tune the Passlock out of the main computer. There's other posts and threads that cover this on here that explain it better. It cost me $250, but it was done in October of last year and the truck starts up great every time now.
One other thing I would suggest: look at all your connections and terminals. Bad grounds and corroded or loose wires have been at the root of many mysterious and troublesome and frustrating electrical problems. My Burb did the "no start when hot" BS in January; turned out to be a loose ignition terminal on the starter solenoid (the small one) and a badly corroded positive cable. If you have to replace the cables, if there's a shop in your area that makes cables (welding or battery shop), that's what I would recommend. The factory style cables are very expensive and hard to find! I had the 8 foot cable that goes from the battery across the fan shroud and down the driver's side inner fender panel to the main computer, for under $12! Would have been over $125 at the parts store and waiting a week for it to come from the east coast.
Not doing that! This is the daily driver and only vehicle for my family, gotta have it back up asap. So I definitely feel your pain on that. There are tricks with resistors and things to bypass the Passlock system, but you have to get into the steering column or under the dashboard.
Thanks for reading my long winded explanation and post, hope this helps with your truck! Post updates on this forum when you get it sorted out!