Did you check if the magnetron fan is working?
Also, check the cavity and magnetron thermal fuses when the microwave stops working.
If everything check out OK - then most likely it's the relay in the control board.
Find Appliance Parts at AppliancePartsPros.com - Largest inventory in the U.S. with 91% of all in-stock orders delivered within 2 business days. Thousands of photos and diagrams make it very easy to find the right part. Enter your appliance model here.