K.L.
I have a couple of thoughts - the first is that he could be overtired. 9 PM is a pretty late bedtime for a toddler, and my babies used to wake up after an hour or two and scream (although not this long!) if they were overtired. I'd try putting him to bed earlier - start with 8:30 because any earlier and he may not be able to fall asleep if he's not used to this. My second thought is that perhaps he has an ear infection - sometimes the only symptom is pain upon lying down. I'd take him for a check-up to rule this out. My other thought was that these could be night terrors, but I doubt that because you described him as interacting with you during the episodes. During a night terror, kids don't acknowledge or recognize that their parents are present, unless the parents manage to wake them up - and it's actually better just to let it run its course rather than trying to wake the child.
Hope this helps,
K.