The two also clashed Tuesday night on education and the proper role of government.
Obama sought to show the Republican Keyes as out of step with many conservatives. The Democrat noted that he and President Bush both support civil unions for gay couples, while Keyes opposes them.
But Obama struggled to explain what in his own religious beliefs leads him to oppose gay marriage.
Keyes reiterated his position that gay couples should not marry because same-sex couples can't conceive children naturally.
The two are vying for the seat being vacated by Republican Sen. Peter Fitzgerald.