Remove all sources of food and secure the outside of the house against them. Or pay a licensed wildlife control person (not a handyman, roofer, or carpenter -- they rarely know how to do it properly) to animal-proof your home. It'll cost between $3K - $5K to make an average home animal-proof.
Raccoons often start working their way into homes using holes gnawed by rodents, and rodents only need tiny gaps to wrap their jaws around to start gnawing their way into your home. So a gap the size of the thickness of a pencil can be seized by a rodent as a starting point to gnaw its way in, and then appropriated by a raccoon as a starting point to chew and tear its way in. So sealing your house up against raccoons necessarily means sealing it up against rodents, as well.
Raccoons are also very smart animals who have excellent dexterity. They can figure out how to open most hasps and latches, for example, including the latches used to secure most garbage can covers to the cans. Some exceptionally bright raccoons will use "tools" such as branches or broomsticks to extend their reach to open latches that are too high for them to reach unassisted.
I also know several wildlife handlers who swear that they've observed raccoons using various objects to pry away building materials or to pry open latches, which would demonstrate a rudimentary understanding of leverage. I have my doubts about that, but raccoons are unquestionably exceptionally bright animals who can figure out ways around exclusion methods that would stop dopier critters.
Laws and regulations about trapping, releasing, or killing raccoons tend to change often based on wildlife officials' observations of raccoon populations and the current prevalence of rabies, distemper, ticks, and so forth at any given time. The last time I called NYSDEC about a destructive raccoon, they told me to kill it and bury or cremate the remains. That was also what they were telling professional Nuisance Wildlife Agents at the time. They didn't want raccoons relocated. They wanted them dead. They're also on the list of animals that New York State residents can humanely kill at any time, with or without a hunting license, if they are damaging or attempting to damage property.
Raccoons have fairly high rates of rabies. If you have to handle a raccoon or its carcass, do so with great care or call a professional.
Rich