It is fine to keep an animal in your house as a pet as long as you take proper care of it.
What the Qur’an and Sunnah Say
The Messenger of Allah said: “A woman was punished for locking up a cat until it died of hunger, and she was sent to hell. She neither fed it nor released it so that it could feed itself.” (Bukhari #2236)
Shaykh Mustafa Umar