Weight loss surgery is otherwise called bariatric surgery, of which there were an estimated 340,770 bariatric procedures performed worldwide in 2011. It is generally considered an option for people with a BMI >40 or with a BMI >35 with an obesity-related disease. Though it is considered controversial for those <18 years old and over 65 years. If you are thinking of this surgery it is best to go to a surgeon and centre that specialises in this type of surgery rather than a general surgeon.
It is considered by some the most effective available treatment for obesity in terms of achieving and maintaining substantial weight loss long term and it has multiple other benefits like improving blood pressure, diabetes and insulin resistance, reduced cholesterol, reduce cancer and heart disease risk.
It is important to note that surgery is not the single answer, you still need to do the other stuff we have discussed. Before anyone has surgery the surgeons will ask you to see a dietician and lose weight before the operation and also may ask you to see a psychologist help with your cravings, emotions and habits around food. This is for a few reasons like reducing the risk of complications and getting you ready for the long-term commitment required, even after the operation.
Also, evidence shows that increasing your physical activity before the operation reduces surgical complications, improves outcomes and improve overall health and fitness.
As for cost, in the USA privately you are looking at between $15000 to 25000. In countries with a public health care system, it may be free or much cheaper but the wait list may be quite long from months to years.