I'm replacing my garden edging (the separator between lawn and flower beds), and I have some treated pine I would like to use.
Like this:

What's the best way to stop the pine from rotting?
I'm replacing my garden edging (the separator between lawn and flower beds), and I have some treated pine I would like to use.
Like this:

What's the best way to stop the pine from rotting?
Buy pressure treated lumber. It's going to cost more than plain pine, but it will last significantly longer in direct contact with the ground, as that's what it's intended for. There's a reason that every telephone/power pole you see is that dark green color.
You might want to consider non-toxic alternatives:
You're kinda fighting a loosing battle. A high grade marine varnish such as Epifanes would do the best in terms of water and UV protection, but I doubt it would give you the look you want. Here's a link to some other alternative marine finishes.