just like potty training a kid, it takes lots of patience and consistency! 1st, you need to take him outside about once an hour. throw a ball for him, or whatever he likes to play with, for about 5-10 minutes. if he doesn't pee or poop, then just try again in another hour, if he does pee or poop, give him TONS of praise WHILE he is going ("great job! good boy! good dog!") and when he's done and comes to you, give him lots of affection and more praise. this will teach him that he gets attention and loving when he pees or poops outside. after awhile you can lengthen the time between going outside, but even fully potty-trained dogs need to go out at least every 3-4 hours. watch for him going to the door, or to the room where the outside door is. if he just sits by the door, or makes circles but doesn't lay down, that usually means he needs to pee
now if he does pee or poop in the house, you need to take him out immediately and say "NO! outside!" and leave him there for a few minutes alone. if you don't see him pee or poop in the house, but find it later, take him back to the spot before you clean it up and say "NO!" and take him outside for a few minutes and say "outside!" (it's best to use one-word commands for a dog) also, try and use carpet cleaner every time b/c if he smells the scent of urine or poop still he might poop there again
also, make sure you leave him outside or in a kennel while you are gone. it's best to keep him in the kennel at night as well until he gets used to going all night without pooping or peeing. (even so, our dogs can usually only hold it from about 11pm until 6am, so about 7 hours)
i hope this helps, patience and consistency are the keys! sounds like you have a good dog, he just needs a little extra attention in this area =)
PS i've got a lab/boxer mix, a pit bull, and a rottweiler puppy