Optical nerve stimulation (ONS) may be useful as a diagnostic tool for intraoperative identification and preservation of the prostate cavernous nerves (CN), responsible for erectile function, during prostate cancer surgery. Successful ONS requires elevating the nerve temperature to within a narrow range (~42 to 47°C) for nerve activation without thermal damage to the nerve. This preliminary study explores a prototype temperature-controlled optical nerve stimulation (TC-ONS) system for maintaining a constant (±1°C) nerve temperature during short-term ONS of the rat prostate CNs. A 150-mW, 1455-nm diode laser was operated in continuous-wave mode, with and without temperature control, during stimulation of the rat CNs for 15 to 30 s through a fiber optic probe with a 1-mm-diameter spot. A microcontroller opened and closed an in-line mechanical shutter in response to an infrared sensor, with a predetermined temperature set point. With TC-ONS, higher laser power settings were used to rapidly and safely elevate the CNs to a temperature necessary for a fast intracavernous pressure response, while also preventing excessive temperatures that would otherwise cause thermal damage to the nerve. With further development, TC-ONS may provide a rapid, stable, and safe method for intraoperative identification and preservation of the prostate CNs.