Check for overhanging branches and holes in the roof. The branches provide a walkway for squirrels, while the holes allow access to the roof rafters.
Cut the branches of trees that are close to the roof. If you cannot cut the branches, fasten a 2-foot-wide metal band around the trunk of the tree. Place the band about 6 to 8 feet above the ground. This will prevent the squirrels from climbing up the tree and using the overhanging branches to enter the rafters.
Block roof openings with the help of 1/2-inch heavy-gauge hardware cloth. Alternatively, you can use metal sheets to plug the holes.
Place a 2-foot-long plastic tube with a 2-inch diameter on wires running into your home. Cut the tube along its length and place it around the wire. This will prevent squirrels from using the wire to gain access to rafters, as the pipe will rotate when squirrels try to walk on it.
Place naphthalene balls in the rafters to drive away squirrels that end up in the rafters. Squirrels cannot stand the smell.
Step live traps in the roof using sunflower seeds, corn or peanut butter as bait. Once the squirrel is trapped, drive it a minimum of five miles from your home and release it. This will prevent the squirrel from returning.