Many experts choose ED treatments proceed from least to most invasive. Surgery, of course is the most invasive procedure. If everything else fails, your doctor might recommend surgery.
Erectile surgery usually has one of three goals: to implant a device that can cause the penis to become erect; to reconstruct arteries to increase flow of blood to the penis; to block off veins that allow blood to leak from the penile tissue. Each one of them has pros and cons. You need to talk to your doctor to evaluate which one is best for you.
Source: National Kidney and Urologic Diseases Information Clearinghouse