2003 Wrangler dies while driving

While driving my 2003 Jeep Wrangler Rubicon, the engine will sometimes just cut out. Sometimes it will restart with no problem. Other times, I have to have it towed. Whenever I get it to my house or one of my mechanic friends, it fires right up. Works for a few days then happens all over. Replaced the fuel pump and most of the wires. Still having the problem. Any suggestions?