The Liberal Democrats had joined the Conservatives in a coalition government led by David Cameron in 2010 after winning 57 seats.
Lib Dem leader says he is stepping down because of problems balancing his faith and his politics.
Mr Farron, who is an evangelical Christian, spent weeks dodging questions about whether he thinks gay sex is a sin before ultimately saying he does not.
The party had just nine MPs prior to the ballot, but managed to secure a total of 12, despite losing five along the way.
His resignation came less than a week after an election in which the Liberal Democrats' signature policy proposal - a referendum on continued membership in the European Union - failed to resonate strongly with voters.
Farron came under pressure on the campaign trail when he refused to directly answer if he believed being gay is a sin.
In his resignation statement Mr Farron said: "The consequences of the focus on my faith is that I have found myself torn between living as a faithful Christian and serving as a political leader".
Farron had said his party would not support either May's Conservatives or the opposition Labour Party in forming a government after last week's election left no outright victor.
During the campaign, Mr Farron faced repeated questions about views on homosexuality and abortion.
Farron emerged three months later as the victor of the party's leadership contest.
"I'm a liberal to my finger tips, and that liberalism means that I am passionate about defending the rights and liberties of people who believe different things to me", he said.
Even so, I seem to be the subject of suspicion because of what I believe and who my faith is in.
Former business secretary Vince Cable, Ed Davey, a former energy and climate change secretary and Jo Swinson, are the favourites to replace him.
Farron said he will serve as leader until next month when the party will hold a leadership election.
Farron succeeded Nick Clegg in 2015 after the party's disastrous election result. "There is still much more work needed to make ourselves more like the nation we seek to represent, but this is a really positive time for our party after increasing our number of MPs by 50%".