The invention relates to an optimization method of a tree structure network based on a 6LoWPAN wireless sensor network. The method includes the following steps: firstly, configuring an optimized treenetwork: jointly building a 6LoWPAN system by three nodes, wherein the three nodes are a border router C, a common router R and a terminal node S, the three nodes separately have different functions,border router configuration functions are added both to program of the border router and the common router, and the border router functions set routers as root nodes; detecting the network capacity, which means the number of nodes of each router; setting priorities in the border router and the common router, wherein the priorities are 0, 1, 2, 3,......, 0 is the highest priority, 1 is the priorityfollowing 0, and so on; setting the priorities according to the network capacity, wherein the network capacity that is low has the high priority; secondly, starting an improved 6LoWPAN network; thirdly, verifying that the border router malfunctions and becomes unreachable in address, at the moment the router with the priority of 1 becoming a border router, then starting the border router configuration functions, and reconstructing the network.