Is it still sticking out, and how many hours has it been out?
What breed is he?
Thanks for answering my questions.
A penis stuck outside the sheath is a very serious problem that requires immediate action. If stuck outside the sheath for too long, it can become infected or necrotic, so getting things back in place as soon as possible is paramount.
One thing you might want to try would be using a cool facecloth along the shaft area to help blood vessels contract and possibly bring the tissue swelling down enough that you can get the penis back into the sheath.
Another thing to look for is to see if the sheath has rolled inside itself. You can dampen the area and unroll the sheath carefully. It's doubtful that this is what is going on since it tends to happen more on dogs with a lot of hair on the sheath that gets tangled up, but you have to check...just to make sure all your bases are covered.
You may also want to try putting him in a sink or tub of cool (NOT cold...tepid/room temperature would be best) water for a few minutes with the water up to his abdomen area to see if that will reduct the swelling.
Finally, in some cases a heavy sugar syrup applied to the area will cause tissue to shrink. 50/50 sugar and water combined may work if you soak paper towels or a face cloth with it and hold it against the extended penis.
Since this problem has gone on for longer than 4 hours, you absolutely need to get him in to a vet as soon as possible. As I said earlier, if left untreated this can become a serious problem that could require surgery to rectify.
More information can be found here:
I hope this helps!!!