You didn't say what your age is, if you're on any other meds, and that sort of thing. Some of the main causes of ED are medications, prostate problems, lack of testosterone, and the thing that Viagra works on, lack of nitric acid. But there are many other possibilities. Generally the only reason to be on Viagra is if you are on the older side in years and have had some of these problems and they can't be fixed. But older folks usually are more concerned with sex with a partner, so I'm just wondering, do you have sex with others, how old are you, and how did you get a prescription for Viagra if you're a young guy who mostly masturbates at this point in your life. The main cause of ED are mental issues. Sometimes we're just tired or feeling blah and it doesn't work and then, because a partner is involved, we get scared and it escalates into a more chronic problem. When we get old things start to go wrong, we get surgeries, stuff happens, and that becomes the main problem.
Have you worked with a urologist first to rule out anything medical? Taking any other medications? How is your mental health? Common physical causes of erectile dysfunction include heart disease, diabetes, nerve damage and high blood pressure. Hormonal issues, such as low testosterone, can also affect your level of sexual desire, preventing you from getting an erection even with Viagra. I'd talk to your doctor.