By using a combination of tail and head you should achieve it
Use head by getting all but the X last line of a file named file.txt .
head -n -X file.txt
It should work for .bash_history too and this could do the trick ?
head -n -X .bash_history > .bash_history
Use tail to keep the Y last line of a file named file.txt .
tail -n Y file.txt
you could combine this to have a script that create 2 temp files then merge them to .bash_history