Are you picking him up every day? You could try putting him outside on sunny days, too. Make sure you fence him in so you don't acciendently lose him on your farm, though.
The dog just takes a long time to gain friendship, since there's not a lot of interaction available with him. For example, you can talk, brush, feed, and milk a cow everyday for affection, but you can only really pet and feed the dog everyday, so he gains hearts naturally slower than other farm animals.