Configuring optimization of wireless sensor networks, which can improve the network performance such as utilization efficiency and network lifetime with minimal energy, has received considerable attention in recent years. In this paper, a cross layer optimal approach is proposed for multi-source linear network and grid network under Rayleigh block-fading channels, which not only achieves an optimal utility but also guarantees the end-to-end reliability. Specifically, in this paper, we first strictly present the optimization method for optimal nodal number N*, nodal placement d* and nodal transmission structure p* under constraints of minimum total energy consumption and minimum unit data transmitting energy consumption. Then, based on the facts that nodal energy consumption is higher for those nodes near the sink and those nodes far from the sink may have remaining energy, a cross layer optimal design is proposed to achieve balanced network energy consumption. The design adopts lower reliability requirement and shorter transmission distance for nodes near the sink, and adopts higher reliability requirement and farther transmission distance for nodes far from the sink, the solvability conditions is given as well. In the end, both the theoretical analysis and experimental results for performance evaluation show that the optimal design indeed can improve the network lifetime by 20-50%, network utility by 20% and guarantee desire level of reliability.