Resource allocation takes place in various kinds of real-world complex systems, such as the traffic systems, social services institutions or organizations, or even the ecosystems. The fundamental principle underlying complex resource-allocation dynamics is Boolean interactions associated with minority games, as resources are generally limited and agents tend to choose the least used resource based on available information. A common but harmful dynamical behavior in resource-allocation systems is herding, where there are time intervals during which a large majority of the agents compete for a few resources, leaving many other resources unused. Accompanying the herd behavior is thus strong fluctuations with time in the number of resources being used. In this paper, we articulate and establish that an intuitive control strategy, namely pinning control, is effective at harnessing the herding dynamics. In particular, by fixing the choices of resources for a few agents while leaving majority of the agents free, herding can be eliminated completely. Our investigation is systematic in that we consider random and targeted pinning and a variety of network topologies, and we carry out a comprehensive analysis in the framework of mean-field theory to understand the working of control. The basic philosophy is then that, when a few agents waive their freedom to choose resources by receiving sufficient incentives, majority of the agents benefit in that they will make fair, efficient, and effective use of the available resources. Our work represents a basic and general framework to address the fundamental issue of fluctuations in complex dynamical systems with significant applications to social, economical and political systems.