As a last resort for severe pain, some women have their uterus and ovaries removed (hysterectomy and oophorectomy). If you have your ovaries taken out, your estrogen level will drop and your symptoms will probably go away. But you may have symptoms of menopause, and you will not be able to get pregnant.
If you are getting close to menopause, you may want to try to manage your symptoms with medicines rather than surgery. Endometriosis usually stops causing problems when you stop having periods.