Castling (9. 0-0) is not a very bad move. You still have a very solid advantage after it due to being a pawn up and having the better pawn structure (black's pawns on a7, c7, c6 are weak and vulnerable).
However you had a better move...
The pawn on c6 is hanging and you could have simply taken it. Both 9. Nxc6 or taking the pawn after queen trades (9. Qxd8 Bxd8 10. Rxd8) are good.
Taking the pawn after queen trades is better, because you will also exchange the knight later on for black's dark squared bishop (which is due to the pawn structure, the stronger piece).
For instance an almost forced sequence could be:
[FEN "r1bq1rk1/p1p1bppp/2p2n2/4N3/4P3/2N5/PPP2PPP/R1BQK2R w KQ - 1 9"]
9. Qxd8 Bxd8
10.Nxc6 Bb7
11.Nxd8 Rfxd8
12.f3
In the end white is left with two pawns up, a strong pawn structure and the better bishop.