I would suggest check the base of the plant and see if the part touching the soil has gotten too soft/rotted. If it is not, then just stake the plant to help it go upright.
This cacti is rather thirstier than most cacti especially when grown outdoors. It appreciates direct sun but if temps are too hot it may not grow leaves and just keep its tall cylindrical trunk. Given more light it may also branch out with arms up and down the trunk or grow leaves. Grown outdoors step up watering during summer, but make sure media is much more grittier and well.draining. The hotter it is the more watering needed at intervals, especially if temps hits 90F to triple digits Less water during colder months.