Yes either make sense but with the distinction that if you use on you would be talking about being on top of the bed and the covers whereas if you use in you would mean under the covers. So you might say that "While I'm asleep in bed, the dog always climbs up in the middle of the night and sleeps on the bed too"
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.