Less than eight months after an epic meltdown that led to a court taking away her children, Britney Spears is reclaiming her role as a mother — to the point where she may be with her boys nearly half the time.

Attorneys for the pop singer and ex-husband Kevin Federline reached an agreement Friday in Los Angeles that allows Spears three visits a week from her children, including two overnights with potential for more. If all goes well, she could have 2-year-old Sean Preston and 1-year-old Jayden James roughly 40 percent of the time, her attorney Laura Wasser said.

The agreement not only increases Spears' time with her sons but also removes need for a trial scheduled for next month to resolve lingering visitation and financial issues.

The couple were married in 2004 and finalized their divorce last July, and they have been wrangling over custody issues for several months since then.