Any process in which a protein is maintained in the endoplasmic reticulum and prevented from moving elsewhere. These include sequestration within the endoplasmic reticulum, protein stabilization to prevent transport elsewhere and the active retrieval of proteins that escape the endoplasmic reticulum.