We discuss a framework for coordinating the response of distributed energy resources (DERs) connected to electric power distribution networks to provide frequency regulation services. These resources include plug-in electric vehicles, thermostatically controlled loads, and microturbines. In this framework, we consider an aggregator that participates in the real-time market by submitting an offer to provide frequency regulation services. If the offer is accepted, the aggregator needs to coordinate the response of a set of DERs. The DERs are compensated through bilateral contracts, the terms of which are negotiated in advance. The DER coordination problem the aggregator is faced with is cast as an optimal control problem, and we propose a bilayer framework to obtain a sub-optimal solution. In the first layer, we utilize model-predictive control techniques driven by regulation signal forecasts and parameter estimates to obtain a reference control signal for the DERs. A second control layer provides closed-loop regulation around the reference computed by the top layer, which minimizes the error that arises due to forecast error, plant-model mismatch, and the slower speed of the optimal control.