Mr Weiner, who served as a congressman for New York between 1999 and 2011, had faced a sentence of up to ten years in prison. He had sought to be spared from prison and receive probation instead.
But prosecutors successfully argued for a significant prison sentence to end his “tragic cycle” of sexting. He will also be ordered to register as a sex offender.
The FBI’s investigation into Mr Weiner became a major part of the 2016 US presidential election when agents found a series of emails between his estranged wife Huma Abedin and Hillary Clinton.
The discovery prompted then-FBI director James Comey to reopen a probe into Ms Clinton’s use of a private email server.
The investigation was dropped two days before election day, but the Clinton campaign argued it proved pivotal in her eventual defeat to Donald Trump.