The best known are probably MSM,
glucosamine, and chondroitin sulfates. There are natural anti-inflammatories, such as boswellia, proteolytic enzymes, devil's claw, ginger, turmeric, Chinese skullcap, and many others. If the magnesium is helping, that indicates muscle pain. Regular skullcap can be useful with this as well. Homeopathic arnica montana can help. Lots of stuff to try. Physical therapy or sports therapy can help if it's an injury or overwork problem.