I found dired+ solution doesn't work for me, because I use to have multiple windows displaying the same buffer, and when I go folder up or down on any of them the buffer is closed for all the windows. This is why I implemented my own solution.
When changing the buffer for parent or sub buffer, if the buffer is displayed in other windows than don't delete it, otherwise delete it. In other words, when you go from one folder to another it will keep deleting previous buffer that is not used by any window, period.
(defun farynaio/dired-go-up-reuse (&optional dir)
(interactive)
(let ((new-dir (if dir (expand-file-name dir) (dired-get-file-for-visit)))
(buffer
(seq-find
(lambda (w) (and (not (eq w (selected-window))) (eq (current-buffer) (window-buffer w))))
(window-list-1))))
(if buffer
(find-file new-dir)
(find-alternate-file new-dir))))
I bind it in the following way:
(define-key dired-mode-map (kbd "<backspace>") (lambda () (interactive) (farynaio/dired-go-up-reuse "..")))