The answer to 'how did rat get in my house' is that rats can squeeze through very small openings as small as a quarter inch wide to gain access to your home. Rats are excellent climbers and can enter through gaps around pipes, vents, windows, and even small holes in your foundation or siding. They are looking for food, water, and shelter, so any opening that provides access to these resources can attract them.
To prevent rats from getting in, it's important to seal up any cracks and gaps around your home, install screens or covers over vents and chimneys, and eliminate sources of food and water that could draw them inside. If you suspect a rat infestation, it's best to call a professional pest control technician to properly identify and address the issue.