Treatment. Your doctor may suggest an over-the-counter antifungal cream or prescribe one to help get rid of the infection. This goes on the head of your penis and under your foreskin until your symptoms go away, which could take 7 to 10 days. You'll also need to avoid sex until you're better.