Two things are useful here. If you are using painters tape on the project, run a piece across the top of the can and down both sides. Pinch the tape across the can opening together so it sticks to itself. For a smaller can or a screw lid type container, wrap a rubber band around top to bottom. Both make a great place to wipe the excess paint off of the brush, keeping the can or container rim clean and able to seal properly