Last fall, Miley Cyrus broke off her engagement and found herself living alone for the first time in her life. Then, to make matters worse, in April her dog Floyd was killed by coyotes. "It's the fucking worst," she says. "I always depended on my boyfriend, and then my dog kind of replaced him." But she found comfort in an unlikely source: the tripped-out music of the Flaming Lips. "Floyd and I always listened to the Flaming Lips," she says. "So now when I listen to that music, I totally feel the presence of him still being there, you know?"
Now, Cyrus and the Lips have joined forces, both onstage and in the studio. Their friendship started late last year when Cyrus read a Rolling Stone interview with frontman Wayne Coyne. "He said he liked my show where I dressed as a mushroom and a rainbow," she says. In February, Cyrus invited two of the Lips onstage in L.A. to perform the band's "Yoshimi Battles the Pink Robots." "Our shows are very childlike, like kids on acid, and hers are too," says Coyne. "We're so much alike in believing art is supposed to be fun. She's just a freak. I love her to death."
The next month, on a hungover off-day from Cyrus' Bangerz tour in Tulsa, Oklahoma, they hit a studio to record what Coyne calls "completely weird" versions of the Beatles' "Lucy in the Sky With Diamonds" and "A Day in the Life." "They taught me to sing into the sadness, and that's helped me a lot on tour," Cyrus says. "Because I would've felt like I can't keep smiling, and I can't, like, go dance on this gold car, and act like I'm happy when I'm fucking not." (Cyrus had to reschedule dates on her current tour after being hospitalized for an allergic reaction.)
The party continued outside the studio; Cyrus and the band have gone clubbing, gotten tattoos on their lips and attended a 2 Chainz show. They're even writing songs together for Cyrus' next album – which she hopes to cut with her new friends after the Bangerz tour wraps. "On my last record, everything we did was with computers," she says. "But they're real musicians – they can change keys on a whim. I've never seen anything like it. They've had me on this journey that's greater than anything I've been on. It's really deep."
This story is from the May 22nd, 2014 issue of Rolling Stone.