Get yourself a test light or voltmeter and next time it doesnt start, get someone to crank it while you check to see whether you are getting voltage at the solenoid exciter wire. If so, and it still isnt starting check the main cable from the battery is good and making a proper connection and the same with all the engine earths.
Its worth checking all these things first before you condemn the starter. You cound replace the starter and still have the same issues.