When DD was 4 and younger, we only went around to people we know who wanted to see her all dressed up. It was a social event and DD didn't really know or care about the candy aspect. We'd hand out candy to the few kids who came to our door with any candy she might have gotten and I usually had one bag of something. Seeing the costumes and dressing up was the big deal of Halloween.
Once DD started school, we did trick-or-treating with school friends in a small group. Since she is an only child, I work on social skills and encourage social interactions a lot. There are unintended "side effects" (such as learning about things we'd prefer she didn't), but ultimately those things will come about at some point in her life and we'd rather she learn how to handle situations with us around while she is young. At that point, slowly, t-o-t became a bit more and more about the candy collected.
Our tradition has been we come home and dump the candy out on the living room floor and we all gather around. We go around the circle (DD, DH, me) and chose 1-2 items each (our favorites) until no one is interested in what is left. We then have a two minute bartering session, which is fun, where we attempt to get what we want from someone else.
Effectively, her "loot" is divided in quarters and becomes a very reasonable amount.
If anyone comes to our door, we use the "unwanted" pile of candy. Other kids love this stuff, so I don't feel bad at all. The rest is either given to grandpa (he usually only chooses a few pieces) or taken to DH's office or put in the teacher's lunge at DD's school or thrown out. We didn't have any kids come to our door this year and my dad is out of town and DH said they already had a bowl of candy at work and I saw a large bowl in the teacher's lounge, so I pitched it into the trash.
DD can eat a few pieces on Halloween and then can eat whatever she wants until it is gone (for the most part, like not right before dinner or in place of a meal). We did let her eat as much as she wanted twice when she was 5-6 years old (once at Halloween and once at a family movie night). She has learned for herself that too much candy at one time makes her feel AWFUL! At her current age, 9, I would not encourage that again for several reasons, but the two most important to me are 1) Her tolerance is higher now and I don't want to point that out to her; and 2) Binging can more easily become a habit-forming eating pattern now.