Mine did this until I fixed the connection on the back of the alternator.
Its the single wire with a push-on connector, I think it's an orange wire if I remember correctly.
Just squeezed the connector with pliers to make it a tighter fit, job done, been fine ever since.