In the current era of the early diagnosis of prostate cancer (PCa) and the development of minimally invasive surgical techniques, erectile dysfunction (ED) represents an important issue, with up to 68% of patients who undergo radical prostatectomy (RP) complaining of postoperative erectile function (EF) impairment. In this context, it is crucial to comprehensively consider all factors possibly associated with the prevention of post-RP ED throughout the entire clinical management of PCa patients. A careful assessment of both oncological and functional baseline characteristics should be carried out for each patient preoperatively. Baseline EF, together with age and the overall burden of comorbidities, has been strongly associated with the chance of post-RP EF recovery. With this goal in mind, internationally validated psychometric instruments are preferable for ensuring proper baseline EF evaluations, and questionnaires should be administered at the proper time before surgery. Careful preoperative counselling is also required, both to respect the patient's wishes and to avoid false expectations regarding eventual recovery of baseline EF. The advent of robotic surgery has led to improvements in the knowledge of prostate surgical anatomy, as reflected by the formal redefinition of nerve-sparing techniques. Overall, comparative studies have shown significantly better EF outcomes for robotic RP than for open techniques, although data from prospective trials have not always been consistent. Preclinical data and several prospective randomized trials have demonstrated the value of treating patients with oral phosphodiesterase 5 inhibitors (PDE5is) after surgery, with the concomitant potential benefit of early re-oxygenation of the erectile tissue, which appears to be crucial for avoiding the eventual penile structural changes that are associated with postoperative neuropraxia and ultimately result in severe ED. For patients who do not properly respond to PDE5is, proper counselling regarding intracavernous treatment should be considered, along with the further possibility of surgical treatment for ED involving the implantation of a penile prosthesis.