Prosecutors had accused Mr Temer of obstructing justice and racketeering, which he has repeatedly denied.
Mr Temer, 77, could only face trial with the approval of two-thirds of the lower house.
Earlier on Wednesday, Mr Temer had tests in hospital for tests after his doctor diagnosed a urinary obstruction.
With 136 of the 477 lawmakers present voting to dismiss the charges as the results came in, President Temer’s opponents could no longer reach the 342 votes required to authorise a trial at the country’s Supreme Court, Reuters news agency reports.
Investigations against the president can now only resume once he steps down at the end of 2018.
Last week, the congressional justice committee also rejected the charges against the president.
The charges stem from a corruption case involving the world’s largest meat-packing firm, JBS. Mr Temer survived a similar congressional vote in August on bribery charges.
He is currently facing the worst approval ratings in Brazilian history, but lawmakers seem prepared to protect him again, correspondents say.
Mr Temer became president last year following the impeachment of his predecessor, Dilma Rousseff.
She was found guilty of tampering with the government accounts in order to hide a growing deficit ahead of her re-election in 2014.