Riku was the person who was to obtain the Kingdom Key, a Keyblade representing the realm of Light. Due to the fact that Riku's heart became obsessed with darkness, it weakened a little and he was not able to wield the Kingdom Key at that time so it went to Sora, the next strong heart in line.
In Hollow Bastion, Riku obtained more control over the darkness and his heart was infact stronger than Sora's and he was able to take the Keyblade from him. But the second visit was a different story. Sora's heart proved to be stronger afterall. Sora's strong will and the bond he has for his friends is what made his heart stronger and what won the Keyblade over.
Although he lost his chances in claiming a Keyblade from the realm of Light, Riku's soul eater which was created from darkness alone served as a strong enough weapon. Riku still had a strong heart, but with weaknesses. In Chain of Memories Riku started to master his darkness and he soon learned that darkness could be used for good and that darkness was his power.
Around that time Mickey and Riku joined forces. Riku's mastery of his darkness and the ability to use his light also led him down a road that Mickey had yet to see from anyone. Using light and darkness back to back was something that brought up interest in Mickey and he wanted to follow Riku and see where that road led.
In their travels Riku took the road to dawn, using his powers accordingly, this is probably how he obtained his Way to Dawn Keyblade. Eventually Riku broke away from Mickey and fell into darkness. Riku came across Diz and started using more of his darkness powers that lays within. Riku's heart was still infected with Xehanort's darkness and it troubled him, that is probably why he left Mickey.
He slowly started to show signs of Xehanort's heartless form and wore a blindfold to hide his eyes, but usually Riku's heart would suppress that darkness to such a degree. Riku most likely stopped using his Keyblade because he fought with darkness more and the requirements for the Keyblade was not met so he probably stopped wielding that Keyblade.
When Riku was informed to capture Roxas by Diz, Riku fought Roxas and lost. Riku was not strong enough. To fight in the world of darkness he had to embrace himself in that same darkness. He broke the chains that locked Xehanort's heartless's darkness in his heart and then he bathed himself in it.
He lost his his former form and took on Xehanort's heartless's form and power, but since his heart was so strong, he kept his mind and feelings intact.
He was able to defeat Roxas. With Riku's new found power, his soul eater returned because his control over masses of darkness became stronger. During the closing of Kingdom Hearts 2, Riku still had Xehanort's heartless form, but he relied on his light again. His light powers probably evened out his darkness and he was able to draw upon his Keyblade once more to fight and defend Kairi.
This was just my take on the subject though.