In my case, the entire compressor was replaced. I'm honestly not sure if the issue was the compressor or the sensor withing the compressor, nor am I sure if the sensor can be replaced separate from the compressor. All that being said, I, obviously, don't have a part number for the sensor.
It is available separately Toyota Part No.: 88336-50040
But the cost to remove a compressor and install the part would approach or exceed the cost of a 'reman' or even a new compressor in some cases.
The sensor is a basically a Clutch Lock Out Mechanism. When there is a significant difference in speed between the engine and the compressor, the sensor assumes the compressor has (or is trying to) lock up. So in order to save the serpentine belt (which drives everything) it shuts off the electromagnetic clutch (coil) on the compressor. Of course this won't help you if the bearing in the clutch pulley has seized...but will save you if it's the compressor.
I don't know why any decent aftermarket compressor (with the same feature) wouldn't work BUT if the sensors they use are cheap and not synced with factory specs then it could well pose a problem.