The transient and the steady-state stability has long been a complex issue in interconnected power system operation due to intermittent time response of various components. The present study, therefore, proposes a model-free deep reinforcement learning controller to ensure both types of stability of Single Machine Infinite Bus (SMIB) system. Initially, a Deep Q-Network (DQN) and Deep Deterministic Policy Gradient (DDPG) algorithms are employed to develop a learning controller to enhance stability of SMIB. Next, the prescribed control objectives of the system are guaranteed by maximizing the long-term reward. The output of the controller is used to adjust the value of a series capacitive compensator in response to given disturbances. The effectiveness of the proposed controller is demonstrated considering the presence of a bolted fault and small signal disturbances. A comparative investigation with a Bang-Bang controller (BBC) shows that the proposed deep reinforcement learning controller outperforms BBC in improving the stability of the SMIB when subjected to disturbances.