Okay, so here's what we did with my Godson per his dentist and pediatrician. I used to watch him and noticed that he was doing much like your little one, when he was nervous or bored. So, we were advised to redirect his behavior to other things. Like if he was doing it when we were watching TV just move it away from his mouth and hand him a cup with water. The key was to catch it before he started, so as to not disrupt the act but to show him there were other things he could do for comfort.
Over a few weeks he did it less and less...but, also my friend started talking to him about sucking his thumb and why he needed to do it. This is a transition time, and will probably disrupt her sleep since she uses this to self soothe. Just be gentle and encouraging. Try not to make it about being a 'big girl' or that it's wrong but that it's time to move onto something new and exciting!
Maybe find a transition object she can use to cuddle with while watching TV or sleeping or in the car. A character she loves and can take with her wherever she goes that she can be responsible for loving and taking care of...it's worth a shot.
I wish you the best of luck! If your little girl is seeing a dentist you may also want to ask he/she or the pedi for tips and advice they have given others.