Raising
Walk 128 steps. This has a chance or raising your entire party's friendship level by +2 points, or +1 level at friendship levels 200 - 255.
Get a massage.
Get a friendly drink, lunch, or combo at the food stalls. This raises your Pokemon's level between +5 to +20 points, depending on what you order.
Battle against the Island Kahuna, an elite four member, or the Champion. This raises your Pokemon's friendship level +5 points at levels 0-99, +4 points at levels 100 - 199, and +3 points at levels 200 - 255.
Level up your Pokemon. You can level up your Pokemon in battle. This will raise your Pokemon's level +5 points at friendship levels 0 -99, +3 points at friendship levels 100 - 199, and +2 points at friendship levels 200 - 255.
Use a Wing. This raises your Pokemon's friendship level +3 points at levels 0 - 99, +2 levels at levels 100 - 199, and +1 point at 200 - 255.
Use vitamins. These include the following: HP Up, Protein, Iron, Calcium, Zinc, Carbos, PP Up, PP Max, and Rare Candy.
Using EV Berries. These include the following: Pomeg Berry, Kelpsy Berry, Qualot Berry, Hondew Berry, Grepa Berry, and Tamato Berry.
Use a battle item. This raises your Pokemon's frienship level +1 point at frienship levels 0-199. Battle items include the following: X Attack, X Defense, X Speed, X Sp. Atk, X Sp. Def, X Accuracy, Dire Hit, and Guard Spec.
Catching your Pokemon in a Luxury Ball raises it's friendship faster.
Having your Pokemon hold a Soothe Bell also raises it's friendship.
Using items such as potions on your Pokemon in battle will raise their friendship.
In Sword/Shield, playing with your Pokemon and making good curries in Pokemon Camp raises their friendship.
You can also see this Bulbapedia page for lots of information about friendship in different games.
Note: In Generation 5, a new mechanic called Affection was introduced. It is different from Friendship. This mechanic was removed in LGPE.
Source
Lowering
To lower friendship, do one of the following:
- Allow your Pokemon to faint in battle
- Use bitter herbal medicine on it. These are Heal Powder, Energy Powder, Energy Root, and Revival Herb
One of the best ways to lower friendship fast is letting your Pokemon faint and continuously reviving it with Revival Herbs.