How do I deal with jealousy?

So about 3 months ago, I ended my relationship with my now ex boyfriend. We decided to just stay friends and we have; we're really good friends and he's someone I can really talk to. Thing is that up until 3 weeks ago I was happy and felt no pain regarding our breakup. He told me that at that point he thought of me as his ex and I felt hurt (he has a lot of ex girlfriends). I spent a few weeks without contacting him and realized that I still have feelings for him. Now he's happily dating a new girl who he can't stop talking about. We don't see each other that often but now I'm feeling a little jealous. I try to ignore him and not think about it but now I've literally started dreaming about him. I don't know what to do. Any advice?