Squirrels can jump directly from the branches to your roof. Cut back branches that hang over your roof, along with any that come within 6 to 8 feet (1.8 to 2.4 m) of your house to help keep them away.  Just trim off enough of the branch that the squirrel can't make the jump anymore. Use a hand saw or pruning shears. Always play it safe when climbing a ladder. Make sure the ladder is sturdy and sitting on a stable surface. If you can, ask someone to hold the ladder while you climb it. If the trim limbs are near power lines, call the power company or a professional to deal with them. Typically, you fit the square metal mesh bottom over the top of your chimney with the cage coming down the sides. Then, you can screw in the 4 screws onto the sides, which will go directly into the tile or stone of your flue. The cap on top and metal mesh on the sides will keep squirrels out.  Squirrels can come in through your fireplace. Pick a cover made of stainless steel mesh. It'll keep the squirrels and other animals out, but you can still use your chimney.  You can find these at home improvement stores. Some require that you screw the metal mesh down into the stone from above. Squirrels can burrow their way into your house through small areas. Go up during the day so you can see sunlight shining through. Fill the holes with metal mesh to block their entry. You can nail or staple the edges into place on the inside or outside of the hole. Be sure to look outside, too. Check under the eaves to see if you can find any holes. Once you cover the areas, add an extra layer of protection by using a repellent. Try one that has capsaicin in it, for instance. This chemical is the one that makes peppers hot, and squirrels don't like it! You can also use predator urine as a deterrent in your yard and around your home. However, this can smell pretty bad, so typically, you'd only use it in your garden, not around your house. You can buy it at home improvement stores.

Summary:
Trim branches that hang close to your roof and chimney. Install a chimney cap if you have a fireplace. Go over your attic space to look for entry points. Spray a repellent around any holes you find.