The answer to this question is a bit complicated.
Avicii wrote the music for the song "Wake Me Up", while Aloe Blacc wrote the lyrics and provided the vocals.
So, in a way, you could say that both Avicii and Aloe Blacc wrote the song.