Supervision is key!
Always watch your puppy, and if you cannot have your eye on him every second then he goes into the crate. Outside every half hour, huge praise when he goes pee or poop outside, outside after eating, after playing, first thing in the morning and before bed as well. Withdraw water about an hour before bedtime. If it is a young pup, set your alarm clock to wake you up a couple of times through the night to take him out again.
Crate at night, when he is left alone, and when you cannot directly supervise him. Keep the crate clean with fresh blankets or towels and in a calm quiet part of the house away from activity.
If he ever does pee in the house, do not scold him or get angry with him. Just quickly pick him up and rush him outside. If he finished his business on the grass, praise praise praise! Remember, it's not his fault that he peed in the house, it's your fault for not supervising closely enough. Scolding peeing or pooping in the house will only teach him that doing his business is bad, and can lead to poop eating or sneaking off to hide the poops somewhere in the house. The association is made that the activity itself is bad, and the pup won't want to get in trouble for doing it so will hide it from you.
Supervision, consistency, and setting the dog up for success!
Good luck!