The MAC protocol of wireless sensor network takes responsibility of allocating wireless channels. Due to the limited energy of wireless sensor nodes, they often work in the way of periodic sleep. However, periodic sleep leads to increase in transmission delay. The realization of periodic sleep depends on time synchronization methods between nodes. A typical representative of competition-based periodic sleep MAC protocol for wireless sensor network is S-MAC. On the basis of the time synchronization algorithm of S-MAC, we propose a clustering time synchronization algorithm by introducing cluster and border node control methods, redesign the format of MAC frame, present the procedure of building cluster, and study the producing, controlling and replacing strategies of border node. This algorithm is suitable for periodic sleep MAC protocols. Results of simulation and practical experiments show that compared with S-MAC, this algorithm can significantly control the numbers of cluster and border node, decrease the overhead of time synchronization and end-to-end transmission delay, so as to save nodes energy and extend lifecycle of the whole network. In a competitive unicast situation, the network throughput is up to 208.66Bps which can satisfy the data transfer requirement of general sensor network. The cost of time synchronization control can be reduced by 35%, and multi-hop transmission delay decreased by 4%.