Rats can indeed bite you in your sleep and it happened to me as a kid years ago.
If you get bitten by a rat while asleep or at anytime else put antibiotic ointment on the wound and then Cover the wound with a clean, dry dressing.
Then go see a doctor anyway just to be sure you don't have any disease that was transmitted by the rat since rats do carry some deadly diseases.