He last posted on Instagram on April 4, captioning a post of himself walking in a house, "It's always sunny in California."
After his death was announced on Friday, stars took to social media to react to the heartbreaking news.
"Devastating news about Avicii, a beautiful soul, passionate and extremely talented with so much more to do. My heart goes out to his family. God bless you Tim x," Calvin Harris tweeted.
"my sincerest and most heartfelt condolences to the friends, fans and families of @Avicii :( Banter aside, nobody can deny what he has accomplished and done for modern dance music and im very proud of him," deadmau5 tweeted.
"Can't find the right words to express how sad I am to find out Avicii passed away. He was so kind, humble, talented and inspiring. Gone far too soon. RIP Tim," Zedd wrote on Instagram.
Back in 2016, the DJ announced his retirement from live touring in a letter to his fans, posted on his website.
"I know I am blessed to be able to travel all around the world and perform, but I have too little left for the life of a real person behind the artist," Avicii wrote (via Rolling Stone). "I will however never let go of music — I will continue to speak to my fans through it."
He explained that after taking a drive across the United States with his friends and his team, he realized he needed to make a change.
"It really helped me realize that I needed to make the change that I'd been struggling with for a while," he shared.
Back in 2014, Avicii was hospitalized in Miami after falling ill, prompting a last-minute cancellation of a show he had scheduled at AVICII Hotel at the SLS South Beach. He also canceled his headlining performance at ULTRA Music Festival.
"I'm really sorry but as some of you have already heard, i will not be playing Ultra Festival this Weekend," he tweeted after falling ill. "My fans know that I have had issues in the past with my stomach and pancreatitis…I woke up on Wednesday morning with serious pain but I flew to Miami anyway, hoping that it would go away. The pain was still there when I landed so I went straight to hospital. I was treated and left later that night."
"Unfortunately, the pain came back yesterday afternoon and I returned to the hospital where they admitted me to stay overnight," Avicii continued. "My doctors have decided to operate and remove my gall bladder tomorrow morning.
"It's a routine procedure and all going well, I expect to be fully recovered and back on my feet in time for my US True Tour. Thanks for your concern everyone, it means a lot to me!"