T.D.
My son is 3 1/2 and he still puts things in his mouth occasionally when he isn't thinking about it. He has gotten significantly better about it as he's gotten older, but it takes concentration. I liken it to someone who bites on pens/pencils or twists their hair--its just something they do without thinking about it. For him though, I was worried about choking hazards so I made it a point to work with him on it. It used to be constant, now it only happens when he is "zoned out"--when he is really concentrating hard on a task, when he is really into a story he's listening to or when he is watching a movie.
Basically every time I see him with his hand in his mouth I tell him to take his hand out of his mouth--calmly and nonchalantly--don't make a big deal out of it. When we are watching a movie I hold him in my lap and "hug" him so that he can't really put his hands into his mouth (he is a cuddler so he doesn't mind this, but some kids might...). If I see him sticking things in his mouth I'll tell him to take a drink from his sippy cup. I give him big things to hold on to so that his hands are full. We play "touch your ears, nose, head, etc.", "clap your hands", etc. when we notice him doing it. Basically anything I can do to keep his hands out of his mouth when he's concentrating hard on something so it breaks the "habit" he has formed. Like I said, it takes time, but I've noticed a significant improvement.
Good luck!