A system for controlling a state of anesthesia of a patient. The system includes a neural sensor configured to be coupled to a patient and generate an output signal indicative of neural activity of the patient; and an electronic processor. The electronic processor is coupled to the neural sensor and to an infusion pump, and is configured to receive the output signal from the neural sensor, estimate a drug concentration of the patient based on a model including a first model parameter, and estimate a second model parameter based on the output signal from the neural sensor. The electronic processor is also configured to update the model for estimating the drug concentration of the patient with the second model parameter, and output control signals to the infusion pump to deliver a drug, the output signals being based on the estimated drug concentration for the patient and estimates of the parameters.