A puppy between 4 to 5 months of age that is properly potty trained should be able to hold their pee in for up to 5 hours if they need too.
But you should take your puppy outside to pee or have someone take the puppy out to pee before those 5 hours.
A puppy should be taken outside to pee and/or poop from 4 to 6 times per day to avoid any accidents in the house.