Horatio serves several functions in the play. In Act 1, scene 1, he provides political context (starting from "That can I …"). He is introduced as a sceptic with regard to the ghost ("Tush, tush, 'twill not appear.") but after seeing it, but he trusts his senses (" I might not this believe / Without the sensible and true avouch / Of mine own eyes."). In other words, when a sceptic is convinced that a ghost is real, the audience can trust it is not imaginary.
He is someone who can be trusted: unlike Polonius, Ophelia, Rosencrantz, Guidenstern and other characters, he is not drawn into the political intrigue at Elsinore. Hamlet may well have Horatio in mind when he tells Polonius in Act 2, scene 2,
Ay, sir; to be honest, as this world goes, is to be
one man picked out of ten thousand.
In Act 3, scene 2, Hamlet describes Horatio as follows:
for thou hast been
As one, in suffering all, that suffers nothing,
A man that fortune's buffets and rewards
Hast ta'en with equal thanks: and blest are those
Whose blood and judgment are so well commingled,
That they are not a pipe for fortune's finger
To sound what stop she please.
There is a degree of stoicism in this description ("Hast ta'en with equal thanks"), but at the same time, reason and passion ("blood and judgment") are well mixed in his character.
The idea of suicide in Act 5, scene 2 does not conflict with this.
I am more an antique Roman than a Dane:
Here's yet some liquor left.
He says he is more like a pagan Roman than a Christian Dane. Christianity condemns suicide ("that the Everlasting had not fix'd / His canon 'gainst self-slaughter!", Act 1, scene 2), but stoicism did not. In fact, Seneca, one of the principal sources on stoicism, described death as a liberation in his letters to Lucillius. Latin version: Epistulae morales ad Lucilium/Liber VIII (emphasis mine):
Non opus est vasto vulnere dividere praecordia: scalpello aperitur ad illam magnam libertatem via et puncto securitas constat.
Translation: Moral letters to Lucilius/Letter 70 (emphasis mine):
If you would pierce your heart, a gaping wound is not necessary; a lancet will open the way to that great freedom, and tranquillity can be purchased at the cost of a pin-prick.