Ever-increasing energy consumption, the depletion of non-renewable resources, the climate impact associated with energy generation, and finite energy-production capacity are important concerns that drive the urgent creation of new solutions for energy management. In this regard, by leveraging the massive connectivity provided by emerging 5G communications, this paper proposes a long-term sustainable Demand-Response (DR) architecture for the efficient management of available energy consumption for Internet of Things (IoT) infrastructures. The proposal uses Network Functions Virtualization (NFV) and Software Defined Networking (SDN) technologies as enablers and promotes the primary use of energy from renewable sources. Associated with architecture, this paper presents a novel consumption model conditioned on availability and in which the consumers are part of the management process. To efficiently use the energy from renewable and non-renewable sources, several management strategies are herein proposed, such as prioritization of the energy supply and workload scheduling using time-shifting capabilities. The complexity of the proposal is analyzed in order to present an appropriate architectural framework. The energy management solution is modeled as an Integer Linear Programming (ILP) and, to verify the improvements in energy utilization, an algorithmic solution and its evaluation are presented. Finally, open research problems and application scenarios are discussed.