Is the dog neutered? He may be marking his territory.
At 3 years old this is a huge possibility if there are any male members of your household he maybe competeing for dominance or even (as daft as it sounds.) competeing for you!. If there are no male members to compete against he may be just letting you know he is boss.
One way to possibly stop this is to have him neutered. But first you could try making sure he knows who is boss and show him his place in the family. Eg, Dont let him on the sofa, eat before him. Let him know he is a dog not a human and then he might not feel the urge to compete for dominance or you.
If all else fails, talk to a vet.