As more and more innovative applications of wireless sensor networks emerge, the need for deploying heterogeneous sensors with different functionalities and capabilities rise rapidly. In this study, we consider a heterogeneous sensor network containing at least two types of sensors: powerful sensors and normal sensors. Powerful sensors have higher energy and computing capacities, and can communicate with normal senors using the same network interface. Communications between powerful sensors may thus be facilitated by building an overlay on top of the normal sensors. The topology of the overlay is critical. The overlay must have a low diameter to efficiently support upper layer applications such as resource discovery. It must also consider the energy consumption of the relaying normal sensors. In this paper, we propose a distributed overlay formation protocol to achieve the above goals. Through simulation, we compare our protocol with two overlay formation protocols, fully connected graph and minimum spanning tree. The results show that our proposed protocol can achieve better performance both in message latency and energy consumption.