It sounds like the bulbous glands (used to maintain the tie when breeding) have swelled outside of the sheath. This is pretty normal. I would use a little ky or other lubricant to keep it from getting dry and then put him in a quiet place.
This can lead to problems if the situation isn't corrected. Often, the vet will have to anesthetize the dog, lubricate the penis and sheath well and then use traction sutures to move the prepuce back up and over the penis. Sometimes it is even necessary to surgically widen the preputial opening. They try to avoid doing this, if at all possible, though. If the opening is too wide, the tip of the
penis may stay extended and this appears to be pretty irritating to it.
If it has not retracted by the morning, you need to see the vet.
Let me know if you still have questions.
