The Matrix is an old trope in speculative fiction, and even non-fiction--it was invented by Descartes ("I think therefore I am" is the one thing he could definitively know of his own volition even if he was in a Matrix--see Discourse on the Method). But it's not nearly mined out as a thought provoking starting point. Brandon Sanderson's Perfect State is a fine entry of this archetype, and a Hugo nominee this year.
The protagonist inhabits a world of which he is the master. He has friends and exciting challenges to overcome, things to learn, and pleasures to indulge in. Even a very powerful nemesis named Melhi. All as a brain in a jar, controlled by an organization called The Wode. His journey toward broader self-awareness--somewhat--begins when he is called by The Wode to meet with the avatar of another Liveborn (real person, as opposed to the simulated people of his world) to virtually have sex, supposedly as part of the ritual of procreation.
Sanderson goes on to begin to explore what life would mean if we were aware that all we perceived was an illusion, all triumph and suffering arranged for the benefit of our character. His protagonist ends up wanting to go beyond those contrived spaces--but after all, at least some (inspired by Descartes and Bishop Berkeley) believe this to be true philosophically, and others technologically.
In the end, we might as well act as if it is all real. Even if we know better. 4 stars