Is perpetual virginity or remaining unmarried superior to marriage?
Yes, it is superior. Although in Hinduism faithfully following the path of a married person is way of dharma, scripture says brahmacharya, especially lifelong celibacy, is superior.
The Mahanarayana Upanishad says (78.12):
Brahma Hiranyagarbha considers that sannyas is the means to liberation. Hiranyagarbha is indeed the Supreme. The Supreme alone is Hiranyagarbha (although he is a personality). Certainly those austerities set forth above are inferior [other austerities listed in the preceding verses of this section]. Sannyasa [monks who have taken vows of celibacy] alone surpasses all. To him who thus knows the all-transcending excellence of sannyas precious knowledge is imparted.
and at the end of his commentary on this verse, Swami Vimalananda states:
Sri Sankaracarya at Brahma Sutra III.4.20 (Available here - https://www.wisdomlib.org/hinduism/book/brahma-sutras/d/doc62753.html) refers to this passage as the conclusive authority behind the practice of sannyas. The illustrious acarya is the most outstanding prototype of a Sannyasin. His example and teachings on the monastic tradition as the pattern of sannyas to be followed by others entering the path. A very large section of Hindus believe that sannyasa represents the perfection in religious life which is attained through the gradual progress in spirituality achieved by fulfilment of the condition laid down for the other three stages of life. Sayana states that while the qualities and practices of different aspirants described in the eleven clauses from the beginning of the Section [of this section of the Mahanarayana Upanishad] were made by human beings--learned and wise though they might be--the transcendence of sannyas over all of them is a pronouncement made by Brahma himself--the first-born-- and so it is secretly guarded precious knowledge--upanishad.
And verse 79.16 concludes with:
O Aruni, having become one possessed of knowledge by realizing Him, the Supreme, through sannyasa, and with your mind fixed in the heart, do not again fall a prey to death. Because sannyasa is thus the supreme means of realization, therefore wise men declare that to be above all other means of liberation.
Sannyasa is extolled in Brahma Sutras III.iv.18-20. (Link given previously) with Sankara's commentaries:
18. Jaimini (thinks that in the texts referred to in the last Sutra there is) a mere reference (to Sannyâsa), and not injunction, because (other texts) condemn (Sannyâsa).
In the text quoted in the last Sutra (Chh. 2. 23. 1) Jaimini says that as there is no word showing that Sannyâsa is enjoined on man, it is a mere reference and not an injunction. The Brihadâranyaka text quoted in the last Sutra says that some person do like that. Sruti here makes a mere statement of fact. It does not enjoin Sannyâsa. Moreover, the text here praises steadfastness in Brahman. “But only one who is firmly established in Brahman attains immortality.” Sacrifice, study, charity, austertiy, studentship, and lifelong celibacy result in the attainment of the virtuous world. But immortality is gained only by him who is firmly established in Brahman. That is what the text says. Further, there are other texts which condemn Sannyâsa. “Having brought to your teacher the wealth that he likes, do not cut off the line of progeny” (Taitt. 1. 11); “To him who is without a son (this) world does not belong” (Taitt. Br. 7. 18. 12) and so on.
19. Bâdarâyana (thinks that Sannyâsa or monastic life) also must be gone through, for the scriptural text (cited) refers equally; to all the four Âsramas (stages of life).
In the text cited, sacrifice etc. refer to the householder’s life, penance to Vânaprastha, studentship to Brahmacharya and ‘one who is firmly established in Brahman’ to Sannyâsa. So the text equally refers to all the four stages of life. The text relating to the first three stages refers to what is enjoined elsewhere. So also does the text relating to Sannyâsa. Hence Sannyâsa also is enjoined and must be gone through by all.
20. Or rather (there is an) injunction (in this text), as in the case of the carrying (of the sacrificial fuel).
This Sutra now tries to establish that there is an injunction about Sannyâsa in the Chhândogya passage cited. There is a Sruti text referring to Agnihotra performed for the manes, which runs as follows: “Let him approach, carrying the sacrificial fuel below; for above he carries it for the gods.” The last clause Jaimini interprets as an injunction, though there is no word in it to that effect, because such an injunction is nowhere else to be found in the scriptures. On account of its newness (Apurvatâ) it is an injunction. Following this argument this Sutra says that in Chh. 2. 23. 1 there is an injunction with respect to Sannyâsa, and not a mere reference, as it is not enjoined anywhere else. Moreover, there are Sruti texts which directly enjoin Sannyâsa: “Or else he may wander forth from the students’ life, or from the house, or from the forest” (Jâb. 4).
Again Jaimini himself says that even glorification, to be relevant, must be in a complimentary relation to an injunction. In the text cited steadfast devotion to Brahman is being praised, and so it has an injunctive value. Now is it possible for one engaged in sacrificial rites etc. to be wholly devoted to Brahman? Devotion to Brahman means constant meditation on It without any disturbing thought. Such a thing is impossible for a householder engaged in ritualistic work. It is possible only for a Sannyâsin who has renounced all work, and not for others.
Neither is it true that Sannyâsa is prescribed only for those who are lame, blind, etc., and therefore unfit for ritualistic work. The text cited above (Jâb. 4) makes no such difference. Moreover, Sannyâsa is meant as a means to the realization of Brahman, and it is to be acquired in a regular prescribed way. “The wandering mendicant with coloured dress, shaven-headed, accepting no gifts, qualifies himself for the realization of Brahman.” Therefore Sannyâsa is prescribed by the scriptures and Knowledge, because it is enjoined on Sannyâsins, is independent of work.
Sankara's commentary on 18 also references scripture on life-long celibacy, not merely after taking a vow of brahmacharya or sannyas.
Lifelong celibacy is especially extolled. In fact if you look at Brahma Sutras Chapter III, section IV contents, you will see that Adhikarana X, XI, and XII discusses those who lapse.
Note: “The question: Is perpetual virginity or remaining unmarried superior to marriage?” is licensed by Stack Exchange Inc (https://hinduism.stackexchange.com/); user contributions licensed under CC BY-SA.