Jesus is almost certainly referring to the Father.
One of the main themes of the discourse in chapter five is the relationship between the Son and the Father. The Son does only what he sees the Father doing. Jesus is working on the Sabbath because his Father is working on the Sabbath. The Father raises the dead and gives life, so the Son also gives life. The Father is to be honored by all, so the Son also is to be honored by all. And so on.
So when we get to verse 31 where Jesus claims that his testimony is not valid if he testifies about himself, it again has to do with his relationship to the Father. If the Father is not also testifying about Jesus, then Jesus' own testimony about himself is not valid. Jesus would be operating on his own, rather than in accord with the Father. But Jesus offers here (as throughout the gospel) the fact of the works (perhaps chiefly, but not limited to, the signs) he has received from the Father (verse 36). The Father testifies about the Son by giving the Son works, which the Son does.
This is corroborated in 8:13-18, where Jesus responds to the Pharisees having challenged Jesus with his own words from 5:31. He explains that his testimony about himself is valid, but, he is not in point of fact the only witness: "I am one who testifies for myself; my other witness is the Father, who sent me."
This sending is another theme throughout John, closely linked with works the Father gives the Son. The Father sent the Son, the Son does the works of the Father in the Father's name. So Jesus appeals to his sending and to his miracles as the basis for belief:
5:24 - Truly, truly, I say to you, whoever hears my word and believes him who sent me has eternal life.
10:37-38 - Do not believe me unless I do what my Father does. But if I do it, even though you do not believe me, believe the miracles, that you may know and understand that the Father is in me, and I in the Father.
As you point out, some commentators, like John Gill, argue on the basis of verses 33-36a that Jesus is referring to John the Baptist. Under this reading, Jesus first offers John as a witness in 33-35, and then in 36a moves to yet a stronger witness, as if he were saying, "Not only do I have John as a witness, but I have another witness even greater still.
Instead, 33-35 should be understood as an interlude. When Jesus states in 32 that he has another who testifies, the Jews he's speaking too might likely have thought he was referring to John the Baptist. Jesus therefor clarifies his remark. I would paraphrase 33-36a so: "Yes, you sent for John. And yes, he has testified truthfully about me. And I mention John so that you might at least believe his testimony since you regard him so well (for a little while anyway). But I'm talking about a witness greater than John..."