Hujar was born in Trenton, New Jersey and abandoned by his parents as an infant, raised by his Ukrainian grandparents. He did not learn English until he started kindergarten. As an adolescent, he moved in with his mother, Rose Murphy, who was living in Manhattan. But the household was abusive and Hujar left to take care of himself as a teen.
He received his first camera in 1947  and attended the School of Industrial Arts where he expressed interest in being a photographer. He was fortunate to encounter an encouraging teacher, the poet Daisy Aldan, and followed her advice of becoming a commercial photography apprentice.
As early as 1956, Hujar began taking photographs that showed signs of his particular style and point of view. After meeting artist Joseph Raffael, Hujar accompanied him on a Fulbright to Italy, where he took many photos. In 1963, Hujar secured his own Fulbright and returned to Italy where he explored and photographed the Palermo catacombs. On this trip, Hujar was accompanied by his lover Paul Thek who would be one of the important relationships of his life.
Back in New York, Hujar was part of the downtown art scene. He appeared in one of Andy Warhol's Screen Tests (which Warhol later included in a series called The Thirteen Most Beautiful Boys). He worked for a spell for successful commercial photographer Harold Krieger and shot for Harper's Bazaar and GQ. He moved in to his deceased friend Jackie Curtis's loft at 189 2nd Avenue. Hujar took many photos of his friends, combining many of them with his Palermo photos for a book called Portraits in Life and Death, published in 1976 by Da Capo Press. The introduction was written by his close friend Susan Sontag and her portrait appears in the book. Using the people in his life as subjects, Hujar took iconic photos of Sontag, Ethyl Eichelberger, Candy Darling, Divine, and his lover David Wojnarowicz  His photograph of Candy Darling on her deathbed in the hospital has been frequently reproduced.
Hujar died at Cabrini Medical Center on November 25, 1987, from AIDS-related pneumonia. Wojnarowicz was with him when he died and made a brief video recording of his body, head to toe, and took 23 photographs. Per Hujar's wishes, his funeral was held at Church of St. Joseph in Greenwich Village. He is buried at Gate of Heaven Cemetery, Valhalla, New York.
At the time of his death, according to his New York Times obituary, Hujar's work was in the permanent collections of the San Francisco Museum of Modern Art, Los Angeles County Museum of Art, and the New Orleans Museum of Art. As of 2014, his work is in:
- Whitney Museum
- Metropolitan Museum of Art
- Museum of Modern Art
- Walker Art Center
- Art Institute of Chicago
- Brooklyn Museum
- Glasgow Gallery of Modern Art
- Stedelijk Museum Amsterdam
In his will, Hujar left his entire photographic archive to his friend Stephen Koch. In 1990, Koch prepared an exhibition of Hujar's work, 132 photographs, held at Grey Art Gallery at New York University. The New York Times review was generally favorable, but plainly cast Hujar in the shadow of fellow downtown photographer, Robert Maplethorpe.
- 2010: Les Rencontres d'Arles festival, France.
- Peter Hujar: A Retrospective, Hujar, Hripsime Vissar, Urs Stahel, and Max Kozloff
- Portraits In Life And Death, Hujar
- Kertess, Klaus : Peter Hujar - Animals and Nudes, Twin Palms, Santa Fe, 2002
- Rollyson, Carl; Paddock, Lisa (2000). Susan Sontag : the making of an icon (1. ed.). New York: W.W. Norton. p. 113. ISBN 0393049280.
- Carr, Cynthia (2012). Fire in the belly : the life and times of David Wojnarowicz (1st U.S. ed.). New York: Bloomsbury. p. 181. ISBN 1596915331.
- "Press release: PETER HUJAR". Maureen Paley. Retrieved 4 November 2014.
- Carr, Cynthia (2012). Fire in the belly : the life and times of David Wojnarowicz (1st U.S. ed.). New York: Bloomsbury. p. 182. ISBN 1596915331.
- Carr, Cynthia (2012). Fire in the belly : the life and times of David Wojnarowicz (1st U.S. ed.). New York: Bloomsbury. p. 183. ISBN 1596915331.
- "The New York Times : Peter Hujar Dies at 53; Made Photo Portraits". November 28, 1987.
- Carr, Cynthia (2012). Fire in the belly : the life and times of David Wojnarowicz (1st U.S. ed.). New York: Bloomsbury. p. 378. ISBN 1596915331.
- Carr, Cynthia (2012). Fire in the belly : the life and times of David Wojnarowicz (1st U.S. ed.). New York: Bloomsbury. p. 379. ISBN 1596915331.
- "Peter Hujar Dies at 53 - Made Photo Portraits". The New York Times. 1987-11-28.
- Leifheit, Matthew. "Stephen Koch on Peter Hujar: "If you're Vincent, you've got to have your Theo."". ArtFCity. Retrieved 5 November 2014.