Finally I had to use regular 6-point socket to remove it.
This is how I did it: I cut the wire off and then used a plier to remove the tip of the oxygen sensor(since it is bad anyway) so I could use the solid socket. I turned the handle very hard and the sensor was finally loosened after a loud noise.