2001 ford ranger, stalling

I purchased new a 2001 Ford Ranger with 2.5 liter engine in 2001. Within 2 wks, it stalled driving along at about 35 mph and wouldn’t restart. I waited for 5-10 mins. It started up and ran fine for a few weeks or months. It’s continued like this for the past 11 yrs. Initially when it acted up I would take it to the dealership where I bought it, but, as the problem never produced any computer codes, they couldn’t figure out what was wrong. Sometimes, it dies completely like you turned off the key; other times, it runs very poorly, sputtering along for a bit before it stalls out. If you wait a while, 20 minutes to several hours, it starts up and runs fine for awhile, weeks to months or even a year or two. A couple of years ago when the event was occurring regularly, a Ford mechanic decided it must be the fuel pump and replaced it. That didn’t help much. I thought it might be an electrical problem involving the computer. I tried replacing the computer relay – maybe that worked for 1-1/2 yrs. or so. Recently, it started stalling again and I replaced the computer relay, and this time it hasn’t been successful.
It is hard to diagnose as it is random and never is presented with a computer diagnostic code. The truck now has 85,000 miles on it. This problem started when it had about 100 miles. Any suggestions? - Thank you