If you use "it" all the time, you won't go wrong. But as Leha says, "he" or "she" is often used if the gender is known, especially if it is a pet.