I am sorry to hear about your gelding's problem. Usually when an animal is having trouble urinating, it can be one of a few things. It can be that he has a urinary tract infection. The classic signs of a UTI are an animal that urinates small amounts very frequently, often with blood. UTI's are usually easily treated with antibiotics. Urinary calculi or stones can also cause this problem, as they can partially obstruct the urethra. Stones are fairly infrequent in horses, and may require surgery to fix. Another possibility are tumors in and around the urinary tract. These can cause constrictions and partial obstructions of the tract.
I would advise having your veterinarian out to perform an examination and urinalysis to get to the root of the problem and determine what medications are neccessary.
I hope this information is helpful.
Good luck with him.