When did anyone accuse him of being gay other than in this thread?
ARE YOU KIDDING ME!
Unlike what Riku had always assumed, Sora still considered him his best friend. Trapped in the darkness by Ansem, Riku had much to contemplate, and hearing Sora's voice at that moment made him feel wanted. Riku is not an evil person; he was manipulated to do evil deeds because he was so focused on certain goals in a certain 'the end justifies the means' mindset. This most likely explains Riku's sudden turning from light to dark to light again; a reassurance that he was still important to Sora, that Sora's ultimate goal was not to stop Ansem but to save his precious friend, easily crushed the negativity brooding in Riku's heart to allow himself to be redeemed.
Indeed, this is most likely why Riku allowed himself to be sealed on the other side of the door of darkness, as an act of redemption on how his selfishness allowed himself to be manipulated into doing so much damage. His final words, 'take care of her,' seemed not so much a reflection of Sora taking care of Kairi for him, but rather, of acceptance that Sora cared about Kairi more than himself but that they'll always carry their own special bond.
-KHI.
Yeah, I read this AWESOME dissertation on SoraXRiku, but the link no longer works so I can't get to it.