Her condition is stable and she has been advised to rest, doctors at Delhi's Ganga Ram Hospital said.
Mrs Gandhi, 69, is the widow of former Prime Minister Rajiv Gandhi.
She is the head of the Nehru-Gandhi dynasty, which has mostly governed India since independence in 1947.
Mrs Gandhi was admitted earlier this month after suffering from dehydration, fever and sustaining an injury during a campaign event in the city of Varanasi.
She underwent surgery to repair the shoulder injury, and was discharged from hospital on Sunday.
"Sonia Gandhi's medical condition at the time of discharge from the hospital is stable. She has been advised rest and continuation of medicines," DS Rana of Ganga Ram Hospital was quoted as saying by the Press Trust of India news agency.
"Mrs Gandhi is likely to visit the hospital for further evaluation of her condition in the coming week."
Her party lost the 2014 general elections to Mr Modi's Hindu nationalist Bharatiya Janata Party (BJP).
In 2011 Mrs Gandhi went to the US to receive surgery for an undisclosed medical condition. In 2013, she was taken to a hospital for a few hours after she fell ill in parliament.
And in 2014, she was admitted to a Delhi hospital for treatment of an infection.

The retired American, 36, said he felt "exploited" by McGregor's camp.
Malignaggi also reacted angrily on social media to an image that showed him down on the canvas during one of two spars with UFC fighter McGregor.
"This was a push down in sparring, post the whole video, rounds one through 12, unedited," he said.
UFC lightweight title-holder McGregor will make his professional boxing debut when five-weight world champion Mayweather comes out of retirement to face him in Las Vegas on 26 August.
Two-weight world champion Malignaggi had been one of the sparring partners helping to prepare McGregor.
Malignaggi claimed he "beat the breaks off" McGregor during one session, and the Irishman pushed him down out of "frustration".
In a post on Instagram, Malignaggi said he will not give away any of McGregor's tactics but added he will speak about what has "upset" him "in time".
"I came with the best intentions and intended to help out," said Malignaggi.
"It's some of the stuff outside the ring and some ways things were handled in training camp that I didn't agree with and made me come to this decision."
Reacting later to the picture of him on the canvas on Twitter, Malignaggi added: "I came to help this camp out, not to be exploited, now you're going to get the truth."
Retired referee Joe Cortez - who officiated when Mayweather beat Ricky Hatton in 2007 - has been working with the McGregor camp to assist in helping the UFC champion adapt to boxing rules.
Earlier this week, Cortez revealed he had to stop a sparring session between McGregor and Malignaggi because the pair were "out of control".
Prior to joining McGregor's team, Malignaggi told BBC Radio 5 live in May that "not a second" of the 29-year-old's bout with former five-weight world champion Mayweather would be competitive.
A seat on the Las Vegas strip?
Mayweather, 40, was undefeated in 49 bouts prior to retiring in 2015 and is a heavy favourite for the sold-out T-Mobile Arena bout.
His promotional company has confirmed nine venues will be used on the Las Vegas strip to show the fight on closed circuit television at a cost of $150 (£114) a seat.
Over 400 cinemas across the US will also broadcast the fight at a cost of around £31 a seat, with organisers confident of "sold out auditoriums".
But earnings from home pay-per-view sales will make up the biggest portion of what is expected to be around $600m of revenue from the fight.
Households in the US will have to pay $99 (£75) for high-definition pictures, while in the UK, the figure will be considerably lower at £19.95.
Both fighters signed a confidentiality agreement, so their split of the earnings is not known, but it is widely accepted Mayweather will earn more than the reported £100m McGregor will make from his professional boxing debut.
Mayweather has said he expects to earn "$300m (£228m) or better in 36 minutes".
The leader of India's main opposition Congress party, Sonia Gandhi, has been discharged from hospital where she had surgery to repair a shoulder injury, doctors say.
[NEXT_CONCEPT]
Former world champion Paulie Malignaggi has left his role as Conor McGregor's sparring partner in the build-up to the Irishman's bout with Floyd Mayweather.