Paraphinosis
Paraphinosis occurs when the opening of the prepuce becomes constricted. This can occur for several reasons.
Hair sometimes surrounds the opening of the sheath and becomes entangled around the base of the penis and the bulbus glands, preventing it from retracting normally. This is usually associated with mating.
A narrowed preputial orifice makes the opening too small, so your dog can't retract his penis. This condition is sometimes genetic. Injury or fracture of your dog's penis can lead to paraphinosis.
A foreign object like a rubber band around your dog's penis may be constricting his prepuce.
Chronic balanoposthitis or an inflammation of your dog's penis and prepuce can cause swelling thus constricting the prepuce opening. Cancer or neoplasia may also be a concern.
Priapism
Though rare in dogs, priampism is almost always a veterinary emergency. It is a neurological condition that causes your dog to have a persistent and painful erection. Sometimes the cause is idiopathic, meaning there is no known cause, but it is often associated with serious health conditions.
Spinal cord lesions are injuries to the spinal cord. Any spinal cord injury may interfere with your dog's motor functions including his ability to retract his penis.
Urinary tract infection which may involve the kidneys, bladder, ureters and urethra is also a concern. Infection of the penis or prepuce is another cause.
A cavernous venous thromboembolism, a blood clot in the veins at the base of the penis, obstructs proper circulation. Poorly oxygenated blood engorges the penis where it is trapped, causing your dog a painful erection.
Trauma during mating may also lead to priapism. An injury can cause the artery in your dog's penis to rupture, pumping large amounts of blood into his penis.
In some cases priapism can be the result of constipation.
Your dog's excessive erection is not normal and is not usually connected with canine sex. Both paraphinosis and priapism are serious conditions and should be addressed immediately.