Ye are my friends, if ye do whatsoever I command you. John 15:14 KJV
Friends enjoy each other and common interests. A friend wants to be with, and be a blessing to, the one called friend.
Jesus is not saying, “I won’t be your friend unless you obey me”. He is not trying to control or manipulate you. He is saying, “If you want to enjoy, and benefit from, my friendship you will do what pleases me”.
What pleases Jesus is doing the will of the Father. Jesus only spoke what He heard the Father say and did what He saw the Father doing. When we do what Jesus tells us we are doing the will of our Father God and glorifying Him.
Can two walk together, except they be agreed? Amos 3:3 KJV
Remember: Loving obedience is better than sacrifical acts and it brings great recompense of reward.