Do you think it's wrong if I try to break into my neighbor's yard?
Yes, it's illegal. Why do you want to break into their yard?
He has a dog that he always keeps outside and it looks sad. I want to pet it.
Trespassing into your neighbor's yard is illegal and wrong. Going into the yard to pet their dog is potentially dangerous because the dog may not be friendly and could bite you. Ask your neighbor if you want to pet their dog.
I've gone into his yard before and never got caught, I'll be fine.
If your neighbor catches you, they may call the police and have you arrested and that would be serious. Please don't do something that puts you in a bad situation. Try to co-exist peacefully with your neighbor.