Air drafts through the walls cost us the most heating and air conditioning dollars, far more than a lack of insulation. Blocking them up is called Air Sealing.
If a crack is meant to move, like a door or a window, then we block the drafts with weather stripping.
If the crack is not meant to move, like the frame around the window we usually block the draft with caulking.
In the case of electrical boxes, one of the largest leaks in the house, we can use air tight electrical boxes, or at least reduce the problem with those foam gaskets that go behind the face plate.
Natural Resources Canada has a great free booklet called "Consumer's Guide to Keeping the Heat In"