I agree with the above posts, punishing will only make it worse. Your pup has had too much freedom for his age. He should still be in a crate. Try starting from the beginning and follow the same time limits and procedures as for a new pup. don't despair, he'll learn, he is still just a baby. Maybe you could try taking him out during the night until he matures and learns to hold.