Only a few people in scripture are called a friend of God.
“Abraham believed God, and it was accounted to him for righteousness.” And he was called the friend of God.” James 2:23
The Bible tells us that we need to be friendly if we want to have friends (Proverbs 18:24)
If you want to be a friend of God, fellowship with Him, draw close, abide in Him, and be obedient to Him.