On November 2, 2006, the spacecraft failed to respond to messages and commands. A faint signal was detected three days later which indicated that the craft had gone into safe mode. All attempts to recontact the Mars Global Surveyor and resolve the problem failed. In January 2007 NASA officially ended the mission.

The Surveyor spacecraft was launched from the Cape Canaveral Air Station in Florida on November 7, 1996 aboard a Delta II rocket. The spacecraft traveled nearly 750 million kilometers (466 million miles) over the course of a 300-day cruise to reach Mars on September 11, 1997.
Upon reaching Mars, Surveyor fired its main rocket engine for the 22-minute Mars orbit insertion (MOI) burn. This maneuver slowed the spacecraft and allowed the planet's gravity to capture it into orbit. Initially, Surveyor entered a highly elliptical orbit that took 45 hours to complete. The orbit had a periapsis of 262 km above the northern hemisphere, and an apoapsis of 54,026 km above the southern hemisphere.
On October 11, the flight team performed a maneuver to raise the periapsis out of the atmosphere. This suspension of aerobraking was performed because air pressure from the atmosphere caused one of Surveyor's two solar panels to bend backward by a slight amount. The panel in question was slightly damaged shortly after launch in November 1996. Aerobraking was resumed on November 7 after flight team members concluded that aerobraking was safe, provided that it occurs at a more gentle pace than proposed by the original mission plan.
Under the new mission plan, aerobraking occurred with the low point of the orbit at an average altitude of 120 km, as opposed to the original altitude of 110 km. This slightly higher altitude resulted in a decrease of 66 percent in terms of air resistance pressure experienced by the spacecraft. During these six months, aerobraking reduced the orbit period to between 12 and 6 hours.
From May to November 1998, aerobraking was temporarily suspended to allow the orbit to drift into the proper position with respect to the Sun. Without this hiatus, 'Surveyor' would complete aerobraking with its orbit in the wrong solar orientation. In order to maximize the efficiency of the mission, these six months were devoted to collecting as much science data as possible. Data was collected between two to four times per day, at the low point of each orbit.
Finally, from November 1998 to March 1999, aerobraking continued and shrank the high point of the orbit down to 450 km. At this altitude, Surveyor circled Mars once every two hours. Aerobraking was scheduled to terminate at the same time the orbit drifted into its proper position with respect to the Sun. In the desired orientation for mapping operations, the spacecraft always crossed the day-side equator at 14:00 (local Mars time) moving from south to north. This geometry was selected to enhance the total quality of the science return.
In its extended mission, MGS did much more than study the planet directly beneath it. It commonly performed rolls and pitches to acquire images off of its nadir track. The roll maneuvers, called ROTOs (Roll Only Targeting Opportunities), rolled the spacecraft left or right from its ground track to shoot images as much as 30° from nadir. It was possible for a pitch maneuver to be added to compensate for the relative motion between the spacecraft and the planet. This was called a CPROTO (Compensation Pitch Roll Targeting Opportunity), and allowed for some very high resolution imaging by the on board MOC (Mars Orbiting Camera).
In addition to this, MGS could shoot pictures of other orbiting bodies, such as other spacecraft and the moons of Mars.
Several days later a faint signal was received indicating that the spacecraft had entered safe mode, and was awaiting further instructions from Earth.
On November 20, the Mars Reconnaissance Orbiter spacecraft attempted to take a picture of Mars Global Surveyor in order to check the craft's orientation towards the Sun and Earth to help diagnose the problem. The effort was unsuccessful.
On 21 November-22 November MGS failed to relay communications to the Opportunity rover on the surface of Mars.
After this failed effort, Mars Exploration Program manager Fuk Li said, "Realistically, we have run through the most likely possibilities for re-establishing communication, and we are facing the likelihood that the amazing flow of scientific observations from Mars Global Surveyor is over."
On January 10, 2007, NASA announced that the loss of the spacecraft might have been caused by a flaw in a parameter update to the spacecraft's system in June, 2006. In this update, two memory addresses were incorrect. Consequently the solar arrays were driven until a hard stop and the spacecraft subsequently went into safe mode. One of the consequences of the parameter flaw was that the spacecraft incorrectly diagnosed a failure of a gimbal motor. In special logic built into MGS' flight software, this meant that the spacecraft was rotated to point the "stuck" solar array at the Sun. But in this geometry, the radiator that should cool down the spacecraft's last surviving battery was also pointed at the sun, resulting in an overheating of (and subsequent failure of) the battery. NASA said this scenario should be treated as preliminary. But ultimately, the fate of the spacecraft may never be known for certain.
On April 13, 2007, NASA reported that the likely cause of the spacecraft's demise was "battery failure caused by a complex sequence of events involving the onboard computer memory and ground commands.
Originally, the spacecraft was to observe Mars for 1 Mars year, roughly 2 Earth years. Based on the valuable science data, the National Aeronautics and Space Administration extended its mission three times.