Configure SQL Server Agent to automatically restart if it stops unexpectedly

To configure SQL Server Agent and SQL Server service to automatically restart if one of them or both stop unexpectedly, using SQL Server Management Studio:

In Object Explorer, Right-click SQL Server Agent, and click Properties:

On the General page, check 'Auto restart SQL Server Agent if it stops unexpectedly' and 'Auto restart SQL Server if it stops unexpectedly':