The 15-year-old flew to London to be with his father last December, whilst he was on tour with his mother, defying a court order to spend Christmas with the singer in New York.
Madonna and Guy Ritchie
On Wednesday, a judge agreed that Rocco will remain in London for the time being where he is currently in school and ordered both parents, who divorced in 2008, to work out a solution.
The judge also scolded the pair over the way they have handled the matter.
Justice Kaplan said: "Frankly both parties have chosen to live their lives in a very public way and may welcome the publicity, but the child has not.
"He would like this matter resolved and the issues concerning him and his family in the most private way possible."
The judge continued: "I'm encouraging the parents to continue to resolve this matter in the best way possible for the child to take this tremendous pressure off their son."
Madonna and Guy's son, Rocco
Addressing his decision to allow Rocco stay in the UK, the judge said: "I am happy that time and effort went into the research of finding a school that he is comfortable with ... [He's] succeeding and liking it.
"The mother hasn't asked that the child be removed from school during this period of time while [custody is resolved]."
Madonna, who is currently on the Asian leg of her Rebel Heart world tour, has posted several childhood photos of Rocco on social media over the past two months.
In the most recent, she wrote: "“I miss this boy so full of life so full of love! I hope we see that Leo Sun soon. The light is blinding!”
A week earlier, she’d also posted a snap of Rocco as a baby, where she’s seen beaming at the camera with the youngster on her back.
Madonna captioned the picture simply: “Tu me manques”, the French phrase meaning, “I miss you”.
Madonna has three other children: daughter Lourdes, 19, with her then-partner Carlos Leon; and David and Mercy, both 10, who were adopted from Malawi.