It is permitted, but some things should be taken into consideration. For instance, according to all the authorities on Jewish Law it is forbidden to play with a pet on Shabbat. If, however, the pet jumps on you it is permissible to stroke it with the proviso that its hairs do not come out because of the stroking. Also, in general, a person should feed his pet before he himself eats.