This may be because of some sort of inflammation which may be casuing swelling in the mucosa, where the eustachian tube is opening.
I wonder if this is first time that you are having this problem or this is one of the episode of the ear problem you are having, as this type of problems are more common in people who are having chronic conditions of sinuses
and have some allergic condition which precipetate the condition.
This also some time happen with air travelling when we face the pressure difference in the air when going up and descending done, but having this problem with car travelling can also happens if you are ascending and the altitude is high in the mountains.
This may be because of some sort of blocking because of sleeping posture and it should be relieved in few days, or I would advice you to have warm saline garggle to releive the congestion if any and if not relieved than have an appoinment with ENT doctor.
Thanks and hope this will help you.