Wainaine died at a hospital in Nairobi on Tuesday night after a short illness, said the friend, who did not want to be named. Vainaina, founder of the Kwani literary magazine, previously suffered a stroke in 2015.
He was a prolific author who won the Caine Award for African Writing for his short history, "Finding a Home" in 2002.
Prior to his stroke, Waynein received a one-year residency in Germany.
Wayneina has never shied away from controversy and was one of the most famous people to publicly declare her sexuality in Africa, where homosexuality is largely viewed as taboo.
In a 2014 article entitled "I'm Homosexual, Mom," Vainaina writes, "Never, Mom. I didn't trust you, Mom. and firm, clear and without bumps from my mouth, strong and clear over her shoulder, in her ear. I am gay, mother. "
He later tweeted that "I'm confused or doubting homosexual. Gay, and pretty happy."
Wainaina also announced on Twitter at Worlds Aid Day 2016 that he is HIV positive.
Binyawang Wainaina was a champion of African art, creativity and culture. In 2010, he conceived the idea of promoting African writing through the Pilgrimage Project, an endeavor in which 14 African writers would travel to African cities in an attempt to write the largest travelogue in Africa.
"The idea is to present our cities to ourselves because Africans are always visible through the eyes of someone else.
"For example, people travel back and forth between London and Lagos, or New York and Nairobi, but not between African countries.
Since then, his stands have been poured into Twitter.