Abstract-In this paper we address the network maintenance problem, in which we aim to maximize the lifetime of a sensor network by adding a set of relays to it. The network lifetime is defined as the time until the network becomes disconnected. The Fiedler value, which is the algebraic connectivity of a graph, is used as an indicator of the network health. The network maintenance problem is formulated as a semi-definite programming (SDP) optimization problem that can be solved efficiently in polynomial time. First, we propose a network maintenance algorithm that obtains the SDP-based locations for a given set of relays. Second we propose a routing algorithm, namely, Weighted Minimum Power Routing (WMPR) algorithm, that significantly increases the network lifetime due to the efficient utilization of the deployed relays. Third, we propose an adaptive network maintenance algorithm that relocates the deployed relays based on the network health indicator. Further, we study the effect of two different transmission scenarios, with and without interference, on the network maintenance algorithm. Finally, we consider the network repair problem, in which we find the minimum number of relays along with their SDPbased locations to reconnect a disconnected network. We propose an iterative network repair algorithm that utilizes the network maintenance algorithm.