Brain-machine interfaces (BMIs) create closed-loop control systems that interact with the brain by recording and modulating neural activity and aim to restore lost function, most commonly motor function in paralyzed patients. Moreover, by precisely manipulating the elements within the control loop, motor BMIs have emerged as new scientific tools for investigating the neural mechanisms underlying control and learning. Beyond motor BMIs, recent work highlights the opportunity to develop closed-loop mood BMIs for restoring lost emotional function in neuropsychiatric disorders and for probing the neural mechanisms of emotion regulation. Here we review significant advances toward functional restoration and scientific discovery in motor BMIs that have been guided by a closed-loop control view. By focusing on this unifying view of BMIs and reviewing recent work, we then provide a perspective on how BMIs could extend to the neuropsychiatric domain.