Bahrain on Thursday followed the United Arab Emirates in announcing that expressing sympathy for Qatar over sanctions imposed by its Gulf neighbours was an offence punishable by a lengthy jail term.
Saudi Arabia, the UAE, Bahrain and Egypt on Monday cut diplomatic ties with Qatar over accusations that the emirate is a champion of extremist groups in the region.
Qatar firmly denies the allegations.
"Any expression of sympathy with the government of Qatar or opposition to the measures taken by the government of Bahrain, whether through social media, Twitter or any other form of communication, is a criminal offence punishable by up to five years in prison and a fine," a Bahraini interior ministry statement said.
The UAE on Wednesday announced a similar decision, warning that offenders could face between three and 15 years in prison and a fine of 500,000 dirhams ($136,125, 120,715 euros) should they criticise the decision to boycott Qatar.
Bahrain, home to the US Navy's Fifth Fleet, has been rocked by unrest since security forces crushed Shiite-led protests in 2011 demanding a constitutional monarchy and an elected prime minister.
The authorities accuse Iran of backing the protesters and aiming to incite unrest in Shiite-majority Bahrain, a charge Tehran denies.
Sunni-ruled Bahrain's strict cyber crime law prohibits the expression of dissent online, including via social media.
Nabeel Rajab, one of the country's most high-profile activists, is currently on trial for a series of tweets criticising a Saudi-led Arab military campaign in Yemen.
Subscribe to Arabian Business' newsletter to receive the latest breaking news and business stories in Dubai,the UAE and the GCC straight to your inbox.