If I usually sleep through flights, is there anyway to prevent the problems I have with ear pain on these long flights?

Awaken for landing. The ear issue on flights occurs when the pressurized plane begins to descend to ground level. Air was pushed out of your middle ear space at high altitude balancing the altitude change on your system. As you return to ground level, you need to be awake to yawn, chew gum or otherwise straighten your eustacian tube so air can re-enter your middle ear & equalize the changing pressure.Pain should stop.
Use Afrin (oxymetazoline) You can also use afrin before getting on the plane or prior to descent. This will promote decongesting the nasal passages and may help with opening the eusachian tubes for the descent.