The thing is I'm very often best buddies with my neigbhors until usually all of the AIs turn on me at once, usually around modern era.
Is this in the setting in the UI or in SQL?
Go to MODS folder, (1)Community Patch, Core Files, Core Changes, and select DiploAIOptions.sql
-- [DISABLE ENDGAME AGGRESSION BOOST]
-- If set to 1, AI civilizations will not receive the large late-game aggression boost towards players that are close to victory.
-- Bonuses/penalties for general victory competition will continue to apply.
-- NOTE: If Victory Competition is disabled, this does nothing.
INSERT INTO Defines (Name, Value)
SELECT 'DIPLOAI_DISABLE_ENDGAME_AGGRESSION', '0';
Set this to 1. I'd also turn off War Bribes:
-- [DISABLE WAR BRIBES]
-- If set to 1, AI civilizations are unable to bribe other AI civilizations into declaring war, but they can still bribe (and be bribed) by humans.
-- If set to 2, the option to bribe another AI civilization into declaring war on a third party is removed globally.
-- War bribes between human players are unaffected by this setting.
INSERT INTO Defines (Name, Value)
SELECT 'DIPLOAI_DISABLE_WAR_BRIBES', '0';
Set this to either 1 or 2. Maybe even disable coop wars too!
-- [DISABLE COOP WAR REQUESTS]
-- If set to 1, AI civilizations will not request that friends join them in a cooperative war against other players.
-- This does not affect offers in the Trade screen to declare war on a third party.
-- Humans can still request that AI friends join them in a cooperative war.
INSERT INTO Defines (Name, Value)
SELECT 'DIPLOAI_DISABLE_COOP_WAR_REQUESTS', '0';
And actually if you do want to play a completely peaceful game there is also a setting in there for that too:
-- [PASSIVE MODE]
-- If set to 1, AI civilizations will never declare war on human players. They also won't attempt Domination Victories, unless they can win one without declaring war on a human.
-- If set to 2, AI civilizations will never declare war on any other civilizations or City-States. They also won't attempt Domination Victories, unless they can win one without declaring war.
-- Humans can still declare war on AI players, and AI players already at war will still fight their opponents.
INSERT INTO Defines (Name, Value)
SELECT 'DIPLOAI_PASSIVE_MODE', '0';