When I yawn or open my mouth wide, I feel pain somewhere around my right ear. It's been going on for about 2 years now.?

Ear/jaw pain. Suspect this problem is not related to your ear, but more likely from your jaw ie TMJ joint. Symptoms could be ligamentous, arthritic or part of TMJ syndrome. Consult your pcp then possibly your dentist.
TMJ. You probably have tmj. Do not chew gums, rough food, meat. May need oral appliances. Can also try acupuncture, injections, pt.