If the sensor replacement doesn't fix it; i would be looking at fuel delievery issues.
A dirty throttle body; can cause stalling problems, a clean, possibly a nee hasket and throttle body alignment, would be a fix for that.
I have had similar symptoms to what you are experiencing with a dying fuel pump. Like many electrical components; the fuel pump was initially., working fine when cold, when the engine was up to operating temps and hot, then it would start malfunctioning. The symptoms were progressively getting, worse over time; at highway speeds, or under load, the engine would cut out. Also, if the started the car cold, it would be fine and then, after driving awhile, parking at a store; then, heat soaking, (temps rise; when turning off the car). After coming back from the store visit; it would be hard or would't start (after a cool off period; it would start again).
Failing fuel pumps themselves; typically, don't throw trouble codes but there was a lean code. Fuel pressure testing, showed normal psi @idle but under load the pump; could not maintain needed volume. Sometimes, you will also see; the check valve is stuck open and it cannot maintain residual pressure, goes immediately to zero, when the engine is turned off (this hard start issue/symptom, is more consistent; not brought on by heat related factors).
For replacement fuel pumps; stick with only oem VDO or Bosch, cheap aftermarket pumps, are notorious for failure or defective out of the box. Airtex and O'Reilly's Import Direct brand pumps; have been documented as very poor quality by members on this site. We have a ton of diagnostic discussions; where a cheaper aftermarket pump is installed, doesn't work right and the final reliable fix, was a replacement oem Bosch or VDO pump.
Sent from my iPhone using Tapatalk