Loose/dirty/corroded connections in the wiring can cause that. If you can find a flaky wiring connection at the distributor, maybe that's it. Good luck...
The sensor isn't available by itself, so if its actually bad, you need a new (or used) disributor.