Here’s what I see:
It wasn’t the sensor, ever.
Your car had to have the head gasket replaced, and when whomever put the engine back together, they didn’t follow the proper procedure to re-time the camshafts to the crankshaft.
You need to have whomever did the head gasket job recheck the cam timing.
Until you do, you will just be throwing parts at the car, and having the exact same thing happen, over and over again.
BC.