Wireless sensor networks (WSNs) have been widely used in structural health monitoring (SHM) for their attractive features such as low cost, high efficiency, and flexibility. The optimal wireless sensor placement in SHM has much difference with traditional tethered sensors. This paper presents a new method to extract the optimal wireless sensor configuration for SHM An objective function that is a trade-off, between the linear dependence of identified mode shapes and the connectivity of WSNs is proposed. A discrete firefly algorithm (DFA) that is based on the basic firefly algorithm (FA) with continuous variable is developed to solve this complicated optimization problem. Some improvements like the one-dimensional binary coding system, the Hamming distance and a parthenogenesis movement scheme are introduced to make the underlying concept of FA applicable in OWSP. A numerical experiment using a long-span suspension bridge demonstrates that the DFA can find the optimal wireless sensor configuration with high dependence of identified mode shapes and good connectivity of the WSN. The effectiveness of the proposed method is validated.