When deploying sensors in the field in order to collect useful information, one of the most important issues is how to prolong the lifetime of the network because of energy constraint of the sensors while guaranteeing that every point in the network is covered. In this paper, we propose the formulation of integer linear programming (ILP) model to find the optimal network flow in the sensor fields in order to maximize the network lifetime while maintaining the coverage and connectivity. By dividing the network into grid structure, the problem can become manageable in size and complexity thus can be applied to large network with high number of nodes. The experimental results show that our proposed scheme outperforms previous protocols in terms of coverage lifetime.