So I read this book 10-15 years ago, but I'm not sure when it was published. It's a YA novel with a young male protagonist, I think, who finds out he can enter a different world when he goes to sleep. When he wakes up, he is back in the real world.
I remember that there was a risk in entering this world, because if he was captured by an enemy, for example, he would not be able wake back up into the real world, and his body would appear comatose to everyone in the real world. At some point in the book, he finds out that someone he knew from real life had a mysterious "death" like this, and was indeed being held captive in this dream world. For some reason, I think it's his piano teacher's son, but I'm very unsure about this detail.
Another detail I remember is that he starts to struggle splitting his time between both worlds, because the more often he goes into this dream world, the less rested he feels after waking up, and starts to lose energy that way.
I have such a vague recollection of the plot, but I've always been wondering what this book was.