Saving your game regularly is paramount to avoid losing progress. You can save your game at almost any time outside of battles, cutscenes, or certain restricted areas. To save, press the X button to open the main menu, then select the 'Save' option. The game will prompt you to confirm if you want to save. Always ensure you see the 'Saving... Do not turn off the power.' message and then the 'Save complete!' message before closing your 3DS or turning off the power. It's a good habit to save before entering new areas, challenging Gym Leaders, or attempting to catch legendary Pokémon. The game only allows for one save file per cartridge, so be mindful of your progress.
