There is fiction that is overtly philosophical - for example you mentioned Sophie's World where the narrative structure stages a tutor & student relationship.
Borges uses more subtle literary devices to explore philosophical ideas. His prose is intricate, ornate & scholarly - for example The Garden of Forking Paths or The Library of Babel which explores the idea of the infinite & meaning in many subtle ways.
Milan Kundera's The Unbearable Lightness of Being starts with a riff on the eternal return of Nietzsche's.
Robinson Crusoe is a mixture of romanticism and the valorisation of reason. It could also be read as the struggle of self-mastery or ijtihad which connects it to a possible Islamic source Ḥayy ibn Yaqẓān (Philosophus Autodictatus). Its also possible to read identify him with the biblical God of Genesis but in the form of the new testament where God is identified with the Logos (reason). In the Post-Colonial context this Gods provenance is reasserted and explicated in the form of History and/or Moral Propaganda (the White European Mans Melancholy Mission and Burden to Civilise Earth). One is forced to ask what is the meaning of civilisation - a question anthropology is situated to ask but perhaps not answer.
Ray Bradbury writes what could be termed Mythic Science Fiction. His themes are religion, modernity & the unconscious. His use of language is reminiscent of the Irish poet Yeats who brought Irish mythology into English Poetry. Bradbury does the same with the mythos of small-town america. Olaf Stapledon rehearses the evolution of the Hegels world-spirit in his Star Maker. Huxley's Brave New World critiques the social & political formation of consumerism & Orwell's 1984 savagely tears into communism. Both visions are seen as total political systems. It's possible to view both as investigations of power - in one manifested by a puritan state & the other by a hedonistic market. The first transcendent (because it is over the mass) and the second immanent (because it is within).
Alice in Wonderland & Through the Looking Glass are rife with language & logic games. (It also has a tradition of quite beautiful illustrations - perhaps to humour Alice who was quite dismissive of books without conversations or pictures).
The short story Axototl by the Argentinian writer displaces the Sartrean phenomenological look between man & man to a teenager and an axototl (larval form of a salamander). The poetry of Sylvia Plath although termed popularly confessional is essentially Freudian.
Although there isn't much fiction that is overtly philosophical - in the sense of being written by a philosopher or starring one and/or signifying its philosophical themes explicitly; once one begins to look at fiction with a philosophical perspective then one begins to discern philosophical attitudes within the text. This is one of the themes of Literary Criticism, though of course not the only one.