The condition that you are describing sounds like orgasmic dysfunction. During sex, sometimes a man experiences inhibited sexual excitement and/or loses the ability to orgasm which is called "anorgasmia".
A complete medical history and physical examination needs to be done. Results are almost always normal. If the problem began after you started taking a medication, this should be discussed with the doctor who prescribed the drug. Treatment depends on the cause of the sexual dysfunction. Medical causes that are reversible or treatable are usually managed medically or surgically. Physical therapy and mechanical aides may prove helpful for some people experiencing sexual dysfunction due to physical illnesses, conditions, or disabilities and a qualified specialist in sex therapy may be helpful.
I'd suggest that you get a physical exam first and discuss the situation with your doctor. At least you'll feel better knowing that you're taking the right steps towards solving the problem.