In this paper, thermostatically controlled loads (TCLs) to the provision of fast ancillary services are investigated. In a residential community, a population of TCLs in smart buildings is able to respond to fast regulation signals in a distributed way via sparse communication infrastructure. A two-layer distributed consensus protocol (TLDCP) is proposed with the optimal control gain design based on the linear quadratic regulator method. In the proposed TLDCP, the communication graph is divided into two-layer considering both the local interaction of TCLs in each building and interconnection among buildings. This method will achieve fast, dynamic and distributed power regulation with fair power and comfort sharing among all participate TCLs. With different supervisory control (e.g. fluctuation mitigation and frequency regulation), the TLDCP controlled TCLs can provide various grid ancillary services. The case studies validate the effectiveness of the proposed method.