As for how long they sleep, it differs from species to species, but it's generally safe to say that rats tend to sleep around 12 to 15 hours per day. These sleep periods are not continuous, though. For example, fancy rats (Rattus norvegicus domesticus) and laboratory rats (Rattus norvegicus) usually have multiple sleep periods throughout the day, often alternating between periods of light sleep, deep sleep, and wakefulness.
It is also important to note that rats are prey animals, so their sleep patterns can also be influenced by their environment and feelings of safety. If they feel threatened or unsafe, they might be more likely to wake up and be alert rather than sleep.