The High Court on Friday declined to decriminalise sections of the penal code that make it illegal to have consensual same sex.
Judges Roselyn Aburili, Chacha Mwita and John Mativo noted that phrases used in the penal code are clear and disclose offences known in law.
They further said a statue is not rendered vague for lack of a definition.
Petitioners wanted the court to quash sections 162 and 165 of the Penal Code.
The law states that a person contravening the sections, whether in public or private, is guilty of a felony and is liable to imprisonment for five years.
Section 162 reads: "Any person who - (a) has carnal knowledge of any person against the order of nature; or (b) has carnal knowledge of an animal; or (c) permits a male person to have carnal knowledge of him or her against the order of nature, is guilty of a felony and is liable to imprisonment for fourteen years.
Section 165 reads that any male person who, whether in public or private, commits any act of gross indecency with another male person, or procures another male person to commit any act of gross indecency with him, or attempts to procure the commission of any such act by any male person with himself or with another male person, whether in public or private, is guilty of a felony and is liable to imprisonment for five years.
The petitioners argue that the State has no business regulating matters of intimacy; they told the judges that gay feelings are natural and that the State should not interfere with the private matters of two consenting adults.
It is their argument that the two sections are discriminatory and contravene various provisions of the Constitution such as the right to equality, freedom from discrimination, human dignity, freedom, security and privacy.
However, religious groups say such matters should be guided by the country's values.
President Uhuru Kenyatta has said in the past that gay rights are a "non-issue" in Kenya, as same-sex relations is not an issue of human rights, but rather of "our own base as a culture".
During a visit to Kenya in 2015, Barack Obama, the then US president, directly challenged Mr Kenyatta, on the need for equality for the LGBT (Lesbian, Gay, Bisexual, and Transgender) community, suggesting that "bad things happen" when countries do not accept their citizens' right to be homosexual.
Mr Kenyatta bluntly shut down Mr Obama's discussion on gay rights terming it "a non-issue" and that Kenya is not keen on embracing homosexuality.