Well that all depends really. How long does your erection usually last?
When you get erect through arousal (and not an unwanted erection), think of things that turn you on to maintain it.
As for medication, all medications have the chance of giving side effects. Viagra, for instance, gives an erection, but it can also make you keep your erection for hours, even after ejaculation.
This could (I emphasise "could") be a case of erectile dysfunction, especially if your erections don't last longer than a few minutes. If you're worried enough about it, go to a doctor about it, they can help and their advice is kept in strictest confidence.
I know it's an embarrassing situation to be in, but if it's troubling you enough that it's affecting your love life, or your life in general, then it needs to be sorted out as soon as possible.