(SELECT * FROM tabella WHERE id>=$id LIMIT 2) UNION (SELECT * FROM tabella WHERE id<$id ORDER BY id DESC LIMIT 1);
Quando estrai i dati ovviamente fai gli opportuni controlli sugli id, perché il precedente o il successivo potrebbero anche non esistere