The cabinet of ministers approved a proposal by the acting justice minister, which will also see offenders fined one million rupees ($5,715), the government said in a statement.
It did not immediately release a definition of the two offences, but said the penal code will be amended to introduce the new penalties.
The move follows repeated government allegations that platforms such as Facebook, Twitter and Whatsapp have been used to spread online hate, in a country where ethnic divisions still linger after decades of war.
Sri Lanka shut down internet access in March last year to prevent further violence when anti-Muslim mobs went on the rampage in the island nation's central region, killing three people and destroying hundreds of homes, shops, vehicles and mosques.
During the violence, mobs used social media platforms to organise attacks against minority groups.
Sri Lankan social networks also saw a surge in fake news after the Easter suicide bombings that left 258 people dead and nearly 500 wounded.
A nine-day ban on platforms including Facebook, Twitter, YouTube, Instagram and WhatsApp was introduced following the Islamic State-claimed attacks on three churches and three hotels on April 21.
Last month Singapore's parliament passed laws to combat fake news that will allow authorities to order the removal of content and could see those convicted of violations imprisoned for up to 10 years.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ