Formal:
* Goeienaand: This is the most formal way to say goodnight.
Informal:
* Goeie nag: This is a more casual way to say goodnight.
* Slaap lekker: This literally translates to "Sleep well" and is a common way to say goodnight to friends and family.
You can also use Totsiens which means "Goodbye" but can be used for goodnight as well, especially in casual settings.
The best option to use depends on the context and who you are talking to.